Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5a802ae

Browse files
authoredNov 13, 2024··
Merge pull request #229 from WeihanLi/dev
1.0.72
2 parents e6c7e9f + 6c403e1 commit 5a802ae

File tree

14 files changed

+39
-57
lines changed

14 files changed

+39
-57
lines changed
 

‎.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
99
"ghcr.io/devcontainers/features/dotnet:2": {
1010
"version": "latest",
11-
"additionalVersions": "9.0.100-preview.3.24204.13"
11+
"additionalVersions": "lts"
1212
}
1313
},
1414
"customizations": {

‎.github/workflows/default.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ jobs:
2626
- name: Setup .NET SDK
2727
uses: actions/setup-dotnet@v4
2828
with:
29-
dotnet-version: |
30-
6.x
31-
7.x
32-
8.x
33-
9.x
29+
dotnet-version: 9.0.x
3430
- name: dotnet info
3531
run: dotnet --info
3632
- name: build

‎.github/workflows/docfx.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ jobs:
1515
- name: Setup .NET SDK
1616
uses: actions/setup-dotnet@v4
1717
with:
18-
dotnet-version: |
19-
6.0.x
20-
7.0.x
21-
8.0.x
22-
9.0.x
18+
dotnet-version: 9.0.x
2319
- name: install DocFX
2420
run: "dotnet tool install -g docfx"
2521
- name: Build docs

‎.github/workflows/dotnet-format.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ jobs:
1414
- name: Setup .NET SDK
1515
uses: actions/setup-dotnet@v4
1616
with:
17-
dotnet-version: |
18-
6.0.x
19-
7.0.x
20-
8.0.x
21-
9.0.x
17+
dotnet-version: 9.0.x
2218
- name: build
2319
run: dotnet build
2420
- name: format

‎Directory.Packages.props‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0'">6.0.0</ExtensionPackageVersion>
66
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">7.0.0</ExtensionPackageVersion>
77
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</ExtensionPackageVersion>
8-
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0-rc.2.24473.5</ExtensionPackageVersion>
8+
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0</ExtensionPackageVersion>
99
</PropertyGroup>
1010
<ItemGroup>
1111
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(ExtensionPackageVersion)" />
@@ -17,7 +17,7 @@
1717
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
1818
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
1919
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
20-
<PackageVersion Include="Serilog" Version="4.0.2" />
20+
<PackageVersion Include="Serilog" Version="4.1.0" />
2121
</ItemGroup>
2222
<ItemGroup>
2323
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
@@ -31,11 +31,11 @@
3131
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
3232
</ItemGroup>
3333
<ItemGroup>
34-
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
35-
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
36-
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.10" />
34+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
35+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
36+
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
3737
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
38-
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
38+
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0" />
3939
<PackageVersion Include="Dapper" Version="2.1.44" />
4040
</ItemGroup>
4141
<ItemGroup>

‎build/version.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<VersionMajor>1</VersionMajor>
44
<VersionMinor>0</VersionMinor>
5-
<VersionPatch>71</VersionPatch>
5+
<VersionPatch>72</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
77
</PropertyGroup>
88
</Project>

‎perf/WeihanLi.Common.Benchmark/Program.cs‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
using BenchmarkDotNet.Running;
2-
using Microsoft.Extensions.Configuration;
3-
using Microsoft.Extensions.DependencyInjection;
42

53
namespace WeihanLi.Common.Benchmark;
64

75
public class Program
86
{
97
public static void Main(string[] args)
108
{
11-
var configurationBuilder = new ConfigurationBuilder();
12-
configurationBuilder.AddJsonFile("appsettings.json");
13-
14-
var serviceCollection = new ServiceCollection();
15-
serviceCollection.AddSingleton<IConfiguration>(configurationBuilder.Build());
16-
DependencyResolver.SetDependencyResolver(serviceCollection);
17-
189
// BenchmarkRunner.Run<MapperTest>();
1910
// BenchmarkRunner.Run<CreateInstanceTest>();
2011
// BenchmarkRunner.Run<DITest>();

‎perf/WeihanLi.Common.Benchmark/WeihanLi.Common.Benchmark.csproj‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<Optimize>true</Optimize>
6-
<TargetFramework>net8.0</TargetFramework>
6+
<TargetFramework>net9.0</TargetFramework>
77
<Benchmark>True</Benchmark>
88
<Nullable>disable</Nullable>
99
</PropertyGroup>
@@ -15,12 +15,5 @@
1515

1616
<ItemGroup>
1717
<ProjectReference Include="..\..\src\WeihanLi.Common\WeihanLi.Common.csproj" />
18-
<ProjectReference Include="..\..\src\WeihanLi.Extensions.Hosting\WeihanLi.Extensions.Hosting.csproj" />
19-
</ItemGroup>
20-
21-
<ItemGroup>
22-
<None Update="appsettings.json">
23-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24-
</None>
2518
</ItemGroup>
2619
</Project>

‎perf/WeihanLi.Common.Benchmark/appsettings.json‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎samples/AspNetCoreSample/AspNetCoreSample.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

‎samples/DotNetCoreSample/DotNetCoreSample.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

‎src/WeihanLi.Common/Helpers/CommandLineParser.cs‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
1414
{
1515
yield break;
1616
}
17+
1718
options ??= new();
1819
var tokenBuilder = new StringBuilder();
1920

@@ -91,9 +92,9 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
9192
/// <summary>
9293
/// Get argument value from arguments
9394
/// </summary>
94-
/// <param name="defaultValue">default argument value when not found</param>
9595
/// <param name="optionName">argument name to get value</param>
9696
/// <param name="args">arguments</param>
97+
/// <param name="defaultValue">default argument value when not found</param>
9798
/// <returns>argument value</returns>
9899
[return: NotNullIfNotNull(nameof(defaultValue))]
99100
public static string? Val(string optionName, string[]? args = null, string? defaultValue = default)
@@ -104,6 +105,19 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
104105
/// <summary>
105106
/// Get argument value from arguments
106107
/// </summary>
108+
/// <param name="optionName">argument name to get value</param>
109+
/// <param name="defaultValue">default argument value when not found</param>
110+
/// <param name="args">arguments</param>
111+
/// <returns>argument value</returns>
112+
[return: NotNullIfNotNull(nameof(defaultValue))]
113+
public static string? Val(string optionName, string? defaultValue, string[]? args = null)
114+
{
115+
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName) ?? defaultValue;
116+
}
117+
118+
/// <summary>
119+
/// Get argument value from arguments
120+
/// </summary>
107121
/// <param name="args">arguments</param>
108122
/// <param name="defaultValue">default argument value when not found</param>
109123
/// <param name="optionName">argument name to get value</param>
@@ -113,11 +127,17 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
113127
{
114128
return GetValueInternal(args, optionName) ?? defaultValue;
115129
}
130+
116131
public static bool BooleanVal(string optionName, string[]? args = null, bool defaultValue = default)
117132
{
118133
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName).ToBoolean(defaultValue);
119134
}
120135

136+
public static bool BooleanVal(string optionName, bool defaultValue = default, string[]? args = null)
137+
{
138+
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName).ToBoolean(defaultValue);
139+
}
140+
121141
public static bool BooleanVal(string[] args, string optionName, bool defaultValue = default)
122142
{
123143
return GetValueInternal(args, optionName).ToBoolean(defaultValue);

‎src/WeihanLi.Common/Helpers/ConcurrentSet.cs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ namespace WeihanLi.Common.Helpers;
55

66
public sealed class ConcurrentSet<T> : IReadOnlyCollection<T>, ICollection<T> where T : notnull
77
{
8-
private readonly ConcurrentDictionary<T, object?> _dictionary = new();
8+
// https://github.com/dotnet/runtime/issues/39919#issuecomment-954774092
9+
private readonly ConcurrentDictionary<T, byte> _dictionary = new();
910

1011
public bool IsEmpty => _dictionary.IsEmpty;
1112

@@ -15,7 +16,7 @@ public sealed class ConcurrentSet<T> : IReadOnlyCollection<T>, ICollection<T> wh
1516

1617
public bool Contains(T item) => _dictionary.ContainsKey(item);
1718

18-
public bool TryAdd(T t) => _dictionary.TryAdd(t, null);
19+
public bool TryAdd(T t) => _dictionary.TryAdd(t, default);
1920

2021
public bool TryRemove(T t) => _dictionary.TryRemove(t, out _);
2122

‎test/WeihanLi.Common.Test/WeihanLi.Common.Test.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<IsTestProject>true</IsTestProject>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

0 commit comments

Comments
 (0)
Please sign in to comment.