Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use dotnet9 #111

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<PomeloVersion>8.0.2</PomeloVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<FrameworkVersion>9.0.0-rc.1.24452.1</FrameworkVersion>
<ExtensionsVersion>9.0.0-rc.1.24431.7</ExtensionsVersion>
<EntityFrameworkVersion>9.0.0-rc.1.24451.1</EntityFrameworkVersion>
<NpgsqlEntityFrameworkCorePostgreSQLVersion>9.0.0-rc.1</NpgsqlEntityFrameworkCorePostgreSQLVersion>
<FrameworkVersion>9.0.0</FrameworkVersion>
<ExtensionsVersion>9.0.0</ExtensionsVersion>
<EntityFrameworkVersion>9.0.0</EntityFrameworkVersion>
<NpgsqlEntityFrameworkCorePostgreSQLVersion>9.0.1</NpgsqlEntityFrameworkCorePostgreSQLVersion>
<PomeloVersion>9.0.0-preview.1</PomeloVersion>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -65,7 +65,7 @@
<PackageReference Update="System.Reactive" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.DiagnosticAdapter" Version="3.1.32" />
<PackageReference Update="Steeltoe.Discovery.Eureka" Version="3.2.0" />
<PackageReference Update="KubernetesClient" Version="12.1.1" />
<PackageReference Update="KubernetesClient" Version="14.0.2" />
<PackageReference Update="dotnet-etcd" Version="4.1.1" />
<PackageReference Update="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Update="Serilog.AspNetCore" Version="8.0.2" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100-rc.1.24452.12",
"version": "9.0.100",
"allowPrerelease": true,
"rollForward": "latestMinor"
}
Expand Down
9 changes: 5 additions & 4 deletions src/AspNetCore/ServiceCollectionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,22 @@ public static MediatRServiceConfiguration AddKnownExceptionValidationBehavior(
/// 将所有实现IQuery接口的类注册为查询类,添加到容器中
/// </summary>
/// <param name="services"></param>
/// <param name="Assemblies"></param>
/// <param name="assemblies"></param>
/// <returns></returns>
public static IServiceCollection AddAllQueries(this IServiceCollection services, params Assembly[] Assemblies)
public static IServiceCollection AddAllQueries(this IServiceCollection services, params Assembly[] assemblies)
{
foreach (var assembly in Assemblies)
foreach (var assembly in assemblies)
{
//从assembly中获取所有实现IQuery接口的类
var queryTypes = assembly.GetTypes().Where(p =>
p.IsClass && !p.IsAbstract && p.GetInterfaces().Any(i => i == typeof(IQuery)));
p is { IsClass: true, IsAbstract: false } && Array.Exists(p.GetInterfaces(), i => i == typeof(IQuery)));
foreach (var queryType in queryTypes)
{
//注册为自己
services.AddScoped(queryType, queryType);
}
}

return services;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// NetCorePalInstrumentation
/// </summary>
public class NetCorePalInstrumentation : IDisposable
public sealed class NetCorePalInstrumentation : IDisposable
{
private readonly DiagnosticSourceSubscriber? _diagnosticSourceSubscriber;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void AddAllQueriesTests()
{
var services = new ServiceCollection();
services.AddAllQueries(typeof(ServiceCollectionExtensionTests).Assembly);
Assert.Equal(1, services.Count);
Assert.Single(services);
var provider = services.BuildServiceProvider();
var queryHandler = provider.GetRequiredService<Query1>();
Assert.NotNull(queryHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public void ToPagedDataTests()
Assert.Equal(1, pagedData.Index);

pagedData = allStrings.ToPagedData(2, 2, true);
Assert.Equal(1, pagedData.Items.Count());
Assert.Single(pagedData.Items);
Assert.Equal(3, pagedData.Total);
Assert.Equal(2, pagedData.Index);

pagedData = allStrings.ToPagedData(3, 2, true);
Assert.Equal(0, pagedData.Items.Count());
Assert.Empty(pagedData.Items);
Assert.Equal(3, pagedData.Total);
Assert.Equal(3, pagedData.Index);

Expand All @@ -31,7 +31,7 @@ public void ToPagedDataTests()
Assert.Equal(1, pagedData.Index);

pagedData = allStrings.ToPagedData(2, 2, false);
Assert.Equal(1, pagedData.Items.Count());
Assert.Single(pagedData.Items);
Assert.Equal(0, pagedData.Total);
Assert.Equal(2, pagedData.Index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ namespace NetCorePal.Web.Application.IntegrationEventHandlers
/// <summary>
///
/// </summary>
/// <param name="mediator"></param>
/// <param name="logger"></param>
public class OrderCreatedIntegrationEventHandler(
IMediator mediator,
ILogger<OrderCreatedIntegrationEventHandler> logger) : IIntegrationEventHandler<OrderCreatedIntegrationEvent>
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions test/NetCorePal.Web/NetCorePal.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />
Expand Down