diff --git a/.github/workflows/PublishNugetPackage.yml b/.github/workflows/PublishNugetPackage.yml index 0f202a9..4a9e213 100644 --- a/.github/workflows/PublishNugetPackage.yml +++ b/.github/workflows/PublishNugetPackage.yml @@ -15,7 +15,7 @@ jobs: - name: Setup .NET Core SDK uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: restore dependencies run: dotnet restore - name: build diff --git a/Directory.Build.props b/Directory.Build.props index dcf392a..4613d73 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@  - net7.0 + net7.0;net8.0 enable enable @@ -8,6 +8,6 @@ latest false - 1.0.0-preview-005 + 1.0.0-preview-006 diff --git a/src/FluentWorkflow.Core/Exceptions/WorkflowException.cs b/src/FluentWorkflow.Core/Exceptions/WorkflowException.cs index f6b8482..d573d90 100644 --- a/src/FluentWorkflow.Core/Exceptions/WorkflowException.cs +++ b/src/FluentWorkflow.Core/Exceptions/WorkflowException.cs @@ -26,6 +26,7 @@ public WorkflowException(string message, Exception inner) : base(message, inner) #region Protected 构造函数 /// + [Obsolete("see https://github.com/dotnet/docs/issues/34893")] protected WorkflowException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/FluentWorkflow.Core/Exceptions/WorkflowInvalidOperationException.cs b/src/FluentWorkflow.Core/Exceptions/WorkflowInvalidOperationException.cs index 7174646..c669632 100644 --- a/src/FluentWorkflow.Core/Exceptions/WorkflowInvalidOperationException.cs +++ b/src/FluentWorkflow.Core/Exceptions/WorkflowInvalidOperationException.cs @@ -25,6 +25,7 @@ public WorkflowInvalidOperationException(string message, Exception inner) : base #region Protected 构造函数 /// + [Obsolete("see https://github.com/dotnet/docs/issues/34893")] protected WorkflowInvalidOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/FluentWorkflow.Core/FluentWorkflow.Core.csproj b/src/FluentWorkflow.Core/FluentWorkflow.Core.csproj index cb0cf77..f2249a0 100644 --- a/src/FluentWorkflow.Core/FluentWorkflow.Core.csproj +++ b/src/FluentWorkflow.Core/FluentWorkflow.Core.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/FluentWorkflow.Core/Implement/InMemoryWorkflowMessageDispatcher.cs b/src/FluentWorkflow.Core/Implement/InMemoryWorkflowMessageDispatcher.cs index c62965d..f86964f 100644 --- a/src/FluentWorkflow.Core/Implement/InMemoryWorkflowMessageDispatcher.cs +++ b/src/FluentWorkflow.Core/Implement/InMemoryWorkflowMessageDispatcher.cs @@ -30,10 +30,7 @@ public InMemoryWorkflowMessageDispatcher(IServiceScopeFactory serviceScopeFactor WorkflowBuildStateCollection workflowBuildStates, ILogger logger) { - if (workflowBuildStates is null) - { - throw new ArgumentNullException(nameof(workflowBuildStates)); - } + ArgumentNullException.ThrowIfNull(workflowBuildStates); _serviceScopeFactory = serviceScopeFactory ?? throw new ArgumentNullException(nameof(serviceScopeFactory)); _eventSubscribeDescriptors = workflowBuildStates.SelectMany(m => m) @@ -48,10 +45,7 @@ public InMemoryWorkflowMessageDispatcher(IServiceScopeFactory serviceScopeFactor /// Task IWorkflowMessageDispatcher.PublishAsync(TMessage message, CancellationToken cancellationToken) { - if (message is null) - { - throw new ArgumentNullException(nameof(message)); - } + ArgumentNullException.ThrowIfNull(message); if (!_eventSubscribeDescriptors.TryGetValue(TMessage.EventName, out var invokerDescriptors)) { diff --git a/src/FluentWorkflow.Core/TracingContext.cs b/src/FluentWorkflow.Core/TracingContext.cs index 561a354..729518b 100644 --- a/src/FluentWorkflow.Core/TracingContext.cs +++ b/src/FluentWorkflow.Core/TracingContext.cs @@ -46,10 +46,7 @@ public readonly struct TracingContext /// public TracingContext(Activity activity) { - if (activity is null) - { - throw new ArgumentNullException(nameof(activity)); - } + ArgumentNullException.ThrowIfNull(activity); var context = activity.Context; TraceId = context.TraceId.ToHexString(); diff --git a/src/FluentWorkflow.Generator/FluentWorkflow.Generator.csproj b/src/FluentWorkflow.Generator/FluentWorkflow.Generator.csproj index d819d84..c7f7d46 100644 --- a/src/FluentWorkflow.Generator/FluentWorkflow.Generator.csproj +++ b/src/FluentWorkflow.Generator/FluentWorkflow.Generator.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0 false diff --git a/src/FluentWorkflow.RabbitMQ/FluentWorkflow.RabbitMQ.csproj b/src/FluentWorkflow.RabbitMQ/FluentWorkflow.RabbitMQ.csproj index 82932e9..32181af 100644 --- a/src/FluentWorkflow.RabbitMQ/FluentWorkflow.RabbitMQ.csproj +++ b/src/FluentWorkflow.RabbitMQ/FluentWorkflow.RabbitMQ.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProvider.cs b/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProvider.cs index 79970f1..17d8bc6 100644 --- a/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProvider.cs +++ b/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProvider.cs @@ -36,7 +36,8 @@ public override async Task CleanupProviderAsync() var options = ServiceProvider.GetRequiredService>(); var connectionProvider = ServiceProvider.GetRequiredService(); using var connection = await connectionProvider.GetAsync(default); - connection.CreateModel().QueueDeleteNoWait(options.Value.ConsumeQueueName, false, false); + using var model = connection.CreateModel(); + model.QueueDeleteNoWait(options.Value.ConsumeQueueName, false, false); await base.CleanupProviderAsync(); } @@ -47,6 +48,7 @@ protected override void ConfigureServices(HostBuilderContext context, IServiceCo services.AddFluentWorkflow() .UseRabbitMQMessageDispatcher(options => { + options.ExchangeName = $"fwf-test-exchange-{Environment.Version.Major}_{Environment.Version.Minor}"; options.ConsumeQueueName = $"RabbitMQTestQueue-{DateTime.Now:yyyy:MM:dd:HH.mm.ss.ffff}"; options.Uri = new Uri(context.Configuration.GetRequiredSection("RabbitMQ").Value!); }); diff --git a/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProviderWithActivity.cs b/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProviderWithActivity.cs index dd4ebf4..fb2281a 100644 --- a/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProviderWithActivity.cs +++ b/test/FluentWorkflow.Test.Base/RabbitMQTestServiceProviderProviderWithActivity.cs @@ -42,7 +42,8 @@ public override async Task CleanupProviderAsync() var options = ServiceProvider.GetRequiredService>(); var connectionProvider = ServiceProvider.GetRequiredService(); using var connection = await connectionProvider.GetAsync(default); - connection.CreateModel().QueueDeleteNoWait(options.Value.ConsumeQueueName, false, false); + using var model = connection.CreateModel(); + model.QueueDeleteNoWait(options.Value.ConsumeQueueName, false, false); await base.CleanupProviderAsync(); _activityListener?.Dispose(); _activityListener = null; @@ -64,6 +65,7 @@ protected override void ConfigureServices(HostBuilderContext context, IServiceCo services.AddFluentWorkflow() .UseRabbitMQMessageDispatcher(options => { + options.ExchangeName = $"fwf-test-exchange-{Environment.Version.Major}_{Environment.Version.Minor}"; options.ConsumeQueueName = $"RabbitMQTestQueue-{DateTime.Now:yyyy:MM:dd:HH.mm.ss.ffff}"; options.Uri = new Uri(context.Configuration.GetRequiredSection("RabbitMQ").Value!); });