Skip to content

Commit

Permalink
Merge pull request #111 from netcorepal/dotnet9
Browse files Browse the repository at this point in the history
use dotnet9
  • Loading branch information
witskeeper authored Dec 2, 2024
2 parents a60113f + 678ae60 commit 4d4580d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
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 @@ -66,7 +66,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 @@ -13,12 +13,12 @@ public void ToPagedDataTests()
Assert.Equal(1, pagedData.PageIndex);

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.PageIndex);

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.PageIndex);

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

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.PageIndex);

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

0 comments on commit 4d4580d

Please sign in to comment.