Skip to content

Commit

Permalink
Merge pull request #229 from WeihanLi/dev
Browse files Browse the repository at this point in the history
1.0.72
  • Loading branch information
WeihanLi authored Nov 13, 2024
2 parents e6c7e9f + 6c403e1 commit 5a802ae
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "latest",
"additionalVersions": "9.0.100-preview.3.24204.13"
"additionalVersions": "lts"
}
},
"customizations": {
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
8.x
9.x
dotnet-version: 9.0.x
- name: dotnet info
run: dotnet --info
- name: build
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
dotnet-version: 9.0.x
- name: install DocFX
run: "dotnet tool install -g docfx"
- name: Build docs
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
dotnet-version: 9.0.x
- name: build
run: dotnet build
- name: format
Expand Down
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0'">6.0.0</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">7.0.0</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0-rc.2.24473.5</ExtensionPackageVersion>
<ExtensionPackageVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0</ExtensionPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(ExtensionPackageVersion)" />
Expand All @@ -17,7 +17,7 @@
<PackageVersion Include="System.Reflection.Emit" Version="4.7.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Serilog" Version="4.0.2" />
<PackageVersion Include="Serilog" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
Expand All @@ -31,11 +31,11 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0" />
<PackageVersion Include="Dapper" Version="2.1.44" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionPatch>71</VersionPatch>
<VersionPatch>72</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
</PropertyGroup>
</Project>
9 changes: 0 additions & 9 deletions perf/WeihanLi.Common.Benchmark/Program.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
using BenchmarkDotNet.Running;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace WeihanLi.Common.Benchmark;

public class Program
{
public static void Main(string[] args)
{
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddJsonFile("appsettings.json");

var serviceCollection = new ServiceCollection();
serviceCollection.AddSingleton<IConfiguration>(configurationBuilder.Build());
DependencyResolver.SetDependencyResolver(serviceCollection);

// BenchmarkRunner.Run<MapperTest>();
// BenchmarkRunner.Run<CreateInstanceTest>();
// BenchmarkRunner.Run<DITest>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>true</Optimize>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Benchmark>True</Benchmark>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand All @@ -15,12 +15,5 @@

<ItemGroup>
<ProjectReference Include="..\..\src\WeihanLi.Common\WeihanLi.Common.csproj" />
<ProjectReference Include="..\..\src\WeihanLi.Extensions.Hosting\WeihanLi.Extensions.Hosting.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
11 changes: 0 additions & 11 deletions perf/WeihanLi.Common.Benchmark/appsettings.json

This file was deleted.

2 changes: 1 addition & 1 deletion samples/AspNetCoreSample/AspNetCoreSample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/DotNetCoreSample/DotNetCoreSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
22 changes: 21 additions & 1 deletion src/WeihanLi.Common/Helpers/CommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
{
yield break;
}

options ??= new();
var tokenBuilder = new StringBuilder();

Expand Down Expand Up @@ -91,9 +92,9 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
/// <summary>
/// Get argument value from arguments
/// </summary>
/// <param name="defaultValue">default argument value when not found</param>
/// <param name="optionName">argument name to get value</param>
/// <param name="args">arguments</param>
/// <param name="defaultValue">default argument value when not found</param>
/// <returns>argument value</returns>
[return: NotNullIfNotNull(nameof(defaultValue))]
public static string? Val(string optionName, string[]? args = null, string? defaultValue = default)
Expand All @@ -104,6 +105,19 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
/// <summary>
/// Get argument value from arguments
/// </summary>
/// <param name="optionName">argument name to get value</param>
/// <param name="defaultValue">default argument value when not found</param>
/// <param name="args">arguments</param>
/// <returns>argument value</returns>
[return: NotNullIfNotNull(nameof(defaultValue))]
public static string? Val(string optionName, string? defaultValue, string[]? args = null)
{
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName) ?? defaultValue;
}

/// <summary>
/// Get argument value from arguments
/// </summary>
/// <param name="args">arguments</param>
/// <param name="defaultValue">default argument value when not found</param>
/// <param name="optionName">argument name to get value</param>
Expand All @@ -113,11 +127,17 @@ public static IEnumerable<string> ParseLine(string line, LineParseOptions? optio
{
return GetValueInternal(args, optionName) ?? defaultValue;
}

public static bool BooleanVal(string optionName, string[]? args = null, bool defaultValue = default)
{
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName).ToBoolean(defaultValue);
}

public static bool BooleanVal(string optionName, bool defaultValue = default, string[]? args = null)
{
return GetValueInternal(args ?? Environment.GetCommandLineArgs(), optionName).ToBoolean(defaultValue);
}

public static bool BooleanVal(string[] args, string optionName, bool defaultValue = default)
{
return GetValueInternal(args, optionName).ToBoolean(defaultValue);
Expand Down
5 changes: 3 additions & 2 deletions src/WeihanLi.Common/Helpers/ConcurrentSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace WeihanLi.Common.Helpers;

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

public bool IsEmpty => _dictionary.IsEmpty;

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

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

public bool TryAdd(T t) => _dictionary.TryAdd(t, null);
public bool TryAdd(T t) => _dictionary.TryAdd(t, default);

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

Expand Down
2 changes: 1 addition & 1 deletion test/WeihanLi.Common.Test/WeihanLi.Common.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down

0 comments on commit 5a802ae

Please sign in to comment.