From 18e055cb7cb03f890b3d51f960f004addd24aa00 Mon Sep 17 00:00:00 2001 From: jxnkwlp Date: Sun, 1 Sep 2024 22:20:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20format=20and=20fix=20code=20warn?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 14 ++++-- .../ApiKeys/IApiKeyAppService.cs | 3 +- ...th2SettingsPermissionDefinitionProvider.cs | 5 +- ...WorkflowAppPermissionDefinitionProvider.cs | 9 +--- .../SettingManagement/OAuth2SettingsDto.cs | 9 +--- .../Localization/WorkflowAppResource.cs | 1 - .../WorkflowAppDomainSharedModule.cs | 10 +--- .../ApiKeys/ApiKeyDomainService.cs | 5 +- .../ApiKeys/IApiKeyRepository.cs | 1 - .../Data/WorkflowAppDbMigrationService.cs | 14 +++--- .../Settings/OAuth2Setting.cs | 2 +- .../Settings/WorkflowAppSettings.cs | 1 - .../WorkflowAppDomainModule.cs | 5 +- .../WorkflowAppDbContext.cs | 23 +++++---- .../Migrations/20220420161644_Initial.cs | 2 - .../Migrations/20220423154337_Add_Elsa.cs | 2 - .../20220508114628_Update_Elsa_1.cs | 2 - .../20220522144358_Update_Elsa_2.cs | 2 - .../20221016125046_Update_Elsa_3.cs | 2 - .../20221023145912_Update_Elsa_4.cs | 2 - .../20221102160115_Update_Elsa_5.cs | 2 - .../20221104163859_Update_GlobalVariable_2.cs | 2 - .../Migrations/20221120145453_Add_ApiKey.cs | 2 - .../Migrations/20230305035156_Update_Abp_7.cs | 2 - .../20230312135138_Add_WorkflowGroup.cs | 2 - .../Migrations/20230312135521_Add_Index.cs | 2 - .../20230615080044_Update_Elsa_6.cs | 2 - .../20230706135617_Update_Abp_723.cs | 2 - .../20230807154316_Update_Elsa_7.cs | 2 - .../20230916070726_Add_WorkflowGroup2.cs | 2 - .../20230928152618_Add_GlobalCode.cs | 2 - .../Migrations/20240205143836_Update_Abp_8.cs | 2 - .../MongoDb/WorkflowAppMongoDbModule.cs | 10 +--- .../WorkflowTeamSetWorkflowRequestDto.cs | 10 ---- .../WorkflowDefinitionAppService.cs | 8 ++-- .../WorkflowInstanceAppService.cs | 5 +- .../Common/WorkflowDefinitionManager.cs | 6 +-- .../Common/WorkflowIdFilterSpecification.cs | 2 +- .../Common/WorkflowImporter.cs | 10 ++-- .../Common/WorkflowInstance.cs | 4 +- .../RoleNameChangedEventHandler.cs | 4 +- .../WorkflowGroupLocalEventHandler.cs | 4 +- .../EventHandlers/WorkflowTeamEventHandler.cs | 4 +- .../Stores/ExpressionExtensions.cs | 4 +- .../Stores/Store.cs | 2 +- .../WorkflowInstanceFaultEqualityComparer.cs | 2 +- .../Activities/Caching/GetCache.cs | 3 +- .../Activities/Caching/RemoveCache.cs | 3 +- .../Activities/Caching/SetCache.cs | 3 +- .../Activities/Clocks/Clock.cs | 2 +- .../Configuration/ReadConfiguration.cs | 2 +- .../Activities/Emailing/SendEmailV2.cs | 6 +-- .../Activities/Primitives/Cancel.cs | 5 +- .../Activities/Scripting/RunCode.cs | 2 +- .../Activities/Tenants/CurrentTenant.cs | 2 +- .../Activities/Users/CurrentUser.cs | 4 +- .../EntityFrameworkCore/EfCoreExtensions.cs | 5 +- .../EfCoreJsonValueConverter.cs | 4 ++ ...aModuleDbContextModelCreatingExtensions.cs | 4 +- .../Repositories/GlobalCodeRepository.cs | 2 +- .../Repositories/GlobalCodeRepository.cs | 2 +- .../CSharp/NuGetPackageService_Tests.cs | 1 - .../CSharpScriptHostTests.cs | 48 ++++++++++++------- .../ElsaModuleExtensionTestBase.cs | 8 +--- .../ElsaModuleExtensionTestModule.cs | 7 +-- .../ElsaModuleConsoleApiClientModule.cs | 1 - .../Program.cs | 9 ++-- .../MongoDB/ElsaModuleMongoDbTestModule.cs | 1 - .../MongoDB/MongoDbFixture.cs | 4 +- .../MongoDB/MongoTestCollection.cs | 2 + 70 files changed, 128 insertions(+), 215 deletions(-) delete mode 100644 src/Passingwind.Abp.ElsaModule.Application.Contracts/Teams/WorkflowTeamSetWorkflowRequestDto.cs diff --git a/.editorconfig b/.editorconfig index 6a0ff9ff..b65079a7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -313,11 +313,15 @@ roslynator_compiler_diagnostic_fixes.enabled = true # roslynator_compiler_diagnostic_fix..enabled = true|false # dotnet_diagnostic..severity = default|none|silent|suggestion|warning|error +dotnet_diagnostic.CA1305.severity = silent +dotnet_diagnostic.CA1310.severity = suggestion +dotnet_diagnostic.CA1848.severity = silent +dotnet_diagnostic.CA1863.severity = suggestion dotnet_diagnostic.Ca2016.severity = warning +dotnet_diagnostic.ca2254.severity = silent +dotnet_diagnostic.IDE0011.severity = suggestion +dotnet_diagnostic.IDE0060.severity = silent +dotnet_diagnostic.RCS1093.severity = suggestion +dotnet_diagnostic.RCS1163.severity = silent dotnet_diagnostic.RCS1251.severity = none -dotnet_diagnostic.CA1848.severity = silent -dotnet_diagnostic.CA1305.severity = silent -dotnet_diagnostic.ide0011.severity = warning dotnet_diagnostic.RCS1251.severity = silent -dotnet_diagnostic.ide0011.severity = silent -dotnet_diagnostic.ca2254.severity = silent diff --git a/app/src/Passingwind.WorkflowApp.Application.Contracts/ApiKeys/IApiKeyAppService.cs b/app/src/Passingwind.WorkflowApp.Application.Contracts/ApiKeys/IApiKeyAppService.cs index de4d0363..ebfa3b3e 100644 --- a/app/src/Passingwind.WorkflowApp.Application.Contracts/ApiKeys/IApiKeyAppService.cs +++ b/app/src/Passingwind.WorkflowApp.Application.Contracts/ApiKeys/IApiKeyAppService.cs @@ -3,7 +3,6 @@ namespace Passingwind.WorkflowApp.ApiKeys; -public interface IApiKeyAppService : ICrudAppService, IApplicationService +public interface IApiKeyAppService : ICrudAppService { - } diff --git a/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/OAuth2SettingsPermissionDefinitionProvider.cs b/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/OAuth2SettingsPermissionDefinitionProvider.cs index ccc10681..173c0f3e 100644 --- a/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/OAuth2SettingsPermissionDefinitionProvider.cs +++ b/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/OAuth2SettingsPermissionDefinitionProvider.cs @@ -11,10 +11,7 @@ public override void Define(IPermissionDefinitionContext context) { var settings = context.GetGroupOrNull(SettingManagementPermissions.GroupName); - if (settings != null) - { - settings.AddPermission(OAuth2SettingsPermissions.OAuth2, L("Permission:OAuth2")); - } + settings?.AddPermission(OAuth2SettingsPermissions.OAuth2, L("Permission:OAuth2")); } private static LocalizableString L(string name) diff --git a/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/WorkflowAppPermissionDefinitionProvider.cs b/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/WorkflowAppPermissionDefinitionProvider.cs index 1c3a7ad1..fd38abbd 100644 --- a/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/WorkflowAppPermissionDefinitionProvider.cs +++ b/app/src/Passingwind.WorkflowApp.Application.Contracts/Permissions/WorkflowAppPermissionDefinitionProvider.cs @@ -1,6 +1,4 @@ -using Passingwind.WorkflowApp.Localization; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.Localization; +using Volo.Abp.Authorization.Permissions; namespace Passingwind.WorkflowApp.Permissions; @@ -12,9 +10,4 @@ public override void Define(IPermissionDefinitionContext context) //Define your own permissions here. Example: //myGroup.AddPermission(WorkflowAppPermissions.MyPermission1, L("Permission:MyPermission1")); } - - private static LocalizableString L(string name) - { - return LocalizableString.Create(name); - } } diff --git a/app/src/Passingwind.WorkflowApp.Application.Contracts/SettingManagement/OAuth2SettingsDto.cs b/app/src/Passingwind.WorkflowApp.Application.Contracts/SettingManagement/OAuth2SettingsDto.cs index c442225d..24446dbc 100644 --- a/app/src/Passingwind.WorkflowApp.Application.Contracts/SettingManagement/OAuth2SettingsDto.cs +++ b/app/src/Passingwind.WorkflowApp.Application.Contracts/SettingManagement/OAuth2SettingsDto.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Passingwind.WorkflowApp.SettingManagement; +namespace Passingwind.WorkflowApp.SettingManagement; public class OAuth2SettingsDto { public bool Enabled { get; set; } diff --git a/app/src/Passingwind.WorkflowApp.Domain.Shared/Localization/WorkflowAppResource.cs b/app/src/Passingwind.WorkflowApp.Domain.Shared/Localization/WorkflowAppResource.cs index b3047c83..fcc29eff 100644 --- a/app/src/Passingwind.WorkflowApp.Domain.Shared/Localization/WorkflowAppResource.cs +++ b/app/src/Passingwind.WorkflowApp.Domain.Shared/Localization/WorkflowAppResource.cs @@ -5,5 +5,4 @@ namespace Passingwind.WorkflowApp.Localization; [LocalizationResourceName("WorkflowApp")] public class WorkflowAppResource { - } diff --git a/app/src/Passingwind.WorkflowApp.Domain.Shared/WorkflowAppDomainSharedModule.cs b/app/src/Passingwind.WorkflowApp.Domain.Shared/WorkflowAppDomainSharedModule.cs index c8fb0883..b9ebf346 100644 --- a/app/src/Passingwind.WorkflowApp.Domain.Shared/WorkflowAppDomainSharedModule.cs +++ b/app/src/Passingwind.WorkflowApp.Domain.Shared/WorkflowAppDomainSharedModule.cs @@ -33,10 +33,7 @@ public override void PreConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.FileSets.AddEmbedded(); - }); + Configure(options => options.FileSets.AddEmbedded()); Configure(options => { @@ -48,9 +45,6 @@ public override void ConfigureServices(ServiceConfigurationContext context) options.DefaultResourceType = typeof(WorkflowAppResource); }); - Configure(options => - { - options.MapCodeNamespace("WorkflowApp", typeof(WorkflowAppResource)); - }); + Configure(options => options.MapCodeNamespace("WorkflowApp", typeof(WorkflowAppResource))); } } diff --git a/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/ApiKeyDomainService.cs b/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/ApiKeyDomainService.cs index 539dddb2..55b008ef 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/ApiKeyDomainService.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/ApiKeyDomainService.cs @@ -43,10 +43,9 @@ public Task GenerateSecretAsync(ApiKey key) return apiKey.UserId; } } - else + else if (Guid.TryParse(userIdString, out Guid userId2)) { - if (Guid.TryParse(userIdString, out Guid userId2)) - return userId2; + return userId2; } return null; diff --git a/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/IApiKeyRepository.cs b/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/IApiKeyRepository.cs index e123c520..f5140c79 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/IApiKeyRepository.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/ApiKeys/IApiKeyRepository.cs @@ -13,5 +13,4 @@ public interface IApiKeyRepository : IRepository Task> GetListAsync(Guid userId, bool includeDetails = false, CancellationToken cancellationToken = default); Task> GetPagedListAsync(int skipCount, int maxResultCount, Guid userId, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default); - } diff --git a/app/src/Passingwind.WorkflowApp.Domain/Data/WorkflowAppDbMigrationService.cs b/app/src/Passingwind.WorkflowApp.Domain/Data/WorkflowAppDbMigrationService.cs index f74fa72c..245f6eac 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/Data/WorkflowAppDbMigrationService.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/Data/WorkflowAppDbMigrationService.cs @@ -52,7 +52,7 @@ public async Task MigrateAsync() await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -64,8 +64,8 @@ public async Task MigrateAsync() if (tenant.ConnectionStrings.Any()) { var tenantConnectionStrings = tenant.ConnectionStrings - .Select(x => x.Value) - .ToList(); + .ConvertAll(x => x.Value) +; if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings)) { @@ -127,10 +127,8 @@ private bool AddInitialMigrationIfNotExist() AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -208,7 +206,7 @@ private string GetSolutionDirectoryPath() { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (Directory.GetFiles(currentDirectory.FullName).Any(f => f.EndsWith(".sln"))) { return currentDirectory.FullName; } diff --git a/app/src/Passingwind.WorkflowApp.Domain/Settings/OAuth2Setting.cs b/app/src/Passingwind.WorkflowApp.Domain/Settings/OAuth2Setting.cs index 7c32a29a..48064694 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/Settings/OAuth2Setting.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/Settings/OAuth2Setting.cs @@ -1,5 +1,5 @@ namespace Passingwind.WorkflowApp.Settings; -public class OAuth2Setting +public static class OAuth2Setting { private const string Prefix = "OAuth2"; diff --git a/app/src/Passingwind.WorkflowApp.Domain/Settings/WorkflowAppSettings.cs b/app/src/Passingwind.WorkflowApp.Domain/Settings/WorkflowAppSettings.cs index b1110a5f..e5c79d3b 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/Settings/WorkflowAppSettings.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/Settings/WorkflowAppSettings.cs @@ -2,7 +2,6 @@ public static class WorkflowAppSettings { - private const string Prefix = "WorkflowApp"; //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; diff --git a/app/src/Passingwind.WorkflowApp.Domain/WorkflowAppDomainModule.cs b/app/src/Passingwind.WorkflowApp.Domain/WorkflowAppDomainModule.cs index 7cac0372..51378f75 100644 --- a/app/src/Passingwind.WorkflowApp.Domain/WorkflowAppDomainModule.cs +++ b/app/src/Passingwind.WorkflowApp.Domain/WorkflowAppDomainModule.cs @@ -31,10 +31,7 @@ public class WorkflowAppDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.IsEnabled = MultiTenancyConsts.IsEnabled; - }); + Configure(options => options.IsEnabled = MultiTenancyConsts.IsEnabled); #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/EntityFrameworkCore/WorkflowAppDbContext.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/EntityFrameworkCore/WorkflowAppDbContext.cs index eb0fa7cf..060bb8f3 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/EntityFrameworkCore/WorkflowAppDbContext.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/EntityFrameworkCore/WorkflowAppDbContext.cs @@ -62,26 +62,25 @@ public class WorkflowAppDbContext : public DbSet ApiKeys { get; set; } - public WorkflowAppDbContext(DbContextOptions options) : base(options) { } - protected override void OnModelCreating(ModelBuilder builder) + protected override void OnModelCreating(ModelBuilder modelBuilder) { - base.OnModelCreating(builder); + base.OnModelCreating(modelBuilder); /* Include modules to your migration db context */ - builder.ConfigurePermissionManagement(); - builder.ConfigureSettingManagement(); - builder.ConfigureBackgroundJobs(); - builder.ConfigureAuditLogging(); - builder.ConfigureIdentity(); - builder.ConfigureFeatureManagement(); - builder.ConfigureTenantManagement(); - builder.ConfigureElsaModule(); + modelBuilder.ConfigurePermissionManagement(); + modelBuilder.ConfigureSettingManagement(); + modelBuilder.ConfigureBackgroundJobs(); + modelBuilder.ConfigureAuditLogging(); + modelBuilder.ConfigureIdentity(); + modelBuilder.ConfigureFeatureManagement(); + modelBuilder.ConfigureTenantManagement(); + modelBuilder.ConfigureElsaModule(); /* Configure your own tables/entities inside here */ @@ -92,7 +91,7 @@ protected override void OnModelCreating(ModelBuilder builder) // //... //}); - builder.Entity(b => + modelBuilder.Entity(b => { b.ToTable(WorkflowAppConsts.DbTablePrefix + "ApiKeys", WorkflowAppConsts.DbSchema); b.ConfigureByConvention(); diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220420161644_Initial.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220420161644_Initial.cs index fe26fba0..d190c59e 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220420161644_Initial.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220420161644_Initial.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Initial : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220423154337_Add_Elsa.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220423154337_Add_Elsa.cs index a62e077a..21f91ab5 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220423154337_Add_Elsa.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220423154337_Add_Elsa.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Add_Elsa : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220508114628_Update_Elsa_1.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220508114628_Update_Elsa_1.cs index 76be88ab..20ff8311 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220508114628_Update_Elsa_1.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220508114628_Update_Elsa_1.cs @@ -1,7 +1,5 @@ using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_Elsa_1 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220522144358_Update_Elsa_2.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220522144358_Update_Elsa_2.cs index fd5b23ac..a4734f0a 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220522144358_Update_Elsa_2.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20220522144358_Update_Elsa_2.cs @@ -1,7 +1,5 @@ using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_Elsa_2 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221016125046_Update_Elsa_3.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221016125046_Update_Elsa_3.cs index 5b857b46..2ae02698 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221016125046_Update_Elsa_3.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221016125046_Update_Elsa_3.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_Elsa_3 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221023145912_Update_Elsa_4.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221023145912_Update_Elsa_4.cs index 870dd15a..cd8cea7a 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221023145912_Update_Elsa_4.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221023145912_Update_Elsa_4.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_Elsa_4 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221102160115_Update_Elsa_5.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221102160115_Update_Elsa_5.cs index 44b3caa5..425e07ce 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221102160115_Update_Elsa_5.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221102160115_Update_Elsa_5.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_Elsa_5 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221104163859_Update_GlobalVariable_2.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221104163859_Update_GlobalVariable_2.cs index 93877f1c..1c1ddc1c 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221104163859_Update_GlobalVariable_2.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221104163859_Update_GlobalVariable_2.cs @@ -1,7 +1,5 @@ using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Update_GlobalVariable_2 : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221120145453_Add_ApiKey.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221120145453_Add_ApiKey.cs index 1e630f67..37677557 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221120145453_Add_ApiKey.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20221120145453_Add_ApiKey.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; public partial class Add_ApiKey : Migration diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230305035156_Update_Abp_7.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230305035156_Update_Abp_7.cs index d6042af1..244f4414 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230305035156_Update_Abp_7.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230305035156_Update_Abp_7.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135138_Add_WorkflowGroup.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135138_Add_WorkflowGroup.cs index 7ef8871d..1be963d4 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135138_Add_WorkflowGroup.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135138_Add_WorkflowGroup.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135521_Add_Index.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135521_Add_Index.cs index 55ef8944..10e5e349 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135521_Add_Index.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230312135521_Add_Index.cs @@ -1,7 +1,5 @@ using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230615080044_Update_Elsa_6.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230615080044_Update_Elsa_6.cs index 42e3c40c..d737a1df 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230615080044_Update_Elsa_6.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230615080044_Update_Elsa_6.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230706135617_Update_Abp_723.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230706135617_Update_Abp_723.cs index 148b40af..f0a08183 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230706135617_Update_Abp_723.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230706135617_Update_Abp_723.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230807154316_Update_Elsa_7.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230807154316_Update_Elsa_7.cs index db3552a2..d0dc6f96 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230807154316_Update_Elsa_7.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230807154316_Update_Elsa_7.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230916070726_Add_WorkflowGroup2.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230916070726_Add_WorkflowGroup2.cs index c1c17111..a3bf60b0 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230916070726_Add_WorkflowGroup2.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230916070726_Add_WorkflowGroup2.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230928152618_Add_GlobalCode.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230928152618_Add_GlobalCode.cs index 447c6a06..6aa79a31 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230928152618_Add_GlobalCode.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20230928152618_Add_GlobalCode.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20240205143836_Update_Abp_8.cs b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20240205143836_Update_Abp_8.cs index c4c66da7..6a453e22 100644 --- a/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20240205143836_Update_Abp_8.cs +++ b/app/src/Passingwind.WorkflowApp.EntityFrameworkCore/Migrations/20240205143836_Update_Abp_8.cs @@ -1,8 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -#nullable disable - namespace Demo.Migrations; /// diff --git a/app/src/Passingwind.WorkflowApp.MongoDB/MongoDb/WorkflowAppMongoDbModule.cs b/app/src/Passingwind.WorkflowApp.MongoDB/MongoDb/WorkflowAppMongoDbModule.cs index 63d10c82..792989fd 100644 --- a/app/src/Passingwind.WorkflowApp.MongoDB/MongoDb/WorkflowAppMongoDbModule.cs +++ b/app/src/Passingwind.WorkflowApp.MongoDB/MongoDb/WorkflowAppMongoDbModule.cs @@ -27,14 +27,8 @@ public class WorkflowAppMongoDbModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddMongoDbContext(options => - { - options.AddDefaultRepositories(); - }); + context.Services.AddMongoDbContext(options => options.AddDefaultRepositories()); - Configure(options => - { - options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; - }); + Configure(options => options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled); } } diff --git a/src/Passingwind.Abp.ElsaModule.Application.Contracts/Teams/WorkflowTeamSetWorkflowRequestDto.cs b/src/Passingwind.Abp.ElsaModule.Application.Contracts/Teams/WorkflowTeamSetWorkflowRequestDto.cs deleted file mode 100644 index 48f838ad..00000000 --- a/src/Passingwind.Abp.ElsaModule.Application.Contracts/Teams/WorkflowTeamSetWorkflowRequestDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Passingwind.Abp.ElsaModule.Teams; - -[Obsolete] -public class WorkflowTeamSetWorkflowRequestDto -{ - public List WorkflowIds { get; set; } -} diff --git a/src/Passingwind.Abp.ElsaModule.Application/WorkflowDefinitions/WorkflowDefinitionAppService.cs b/src/Passingwind.Abp.ElsaModule.Application/WorkflowDefinitions/WorkflowDefinitionAppService.cs index 51927a00..7f845e5f 100644 --- a/src/Passingwind.Abp.ElsaModule.Application/WorkflowDefinitions/WorkflowDefinitionAppService.cs +++ b/src/Passingwind.Abp.ElsaModule.Application/WorkflowDefinitions/WorkflowDefinitionAppService.cs @@ -586,7 +586,7 @@ public async Task ExportAsync(WorkflowDefinitionExportRequ ZipFile.CreateFromDirectory(exportTempDir, zipFilePath); - Logger.LogInformation("Workflow definition export zip file created: {0}", zipFilePath); + Logger.LogInformation("Workflow definition export zip file created: {ZipFilePath}", zipFilePath); return new RemoteStreamContent(File.OpenRead(zipFilePath), $"{DateTime.UtcNow:yyyyMMddHHmmss}.zip", "application/stream"); } @@ -599,8 +599,10 @@ public async Task ExportAsync(WorkflowDefinitionExportRequ [Authorize(Policy = ElsaModulePermissions.Definitions.Import)] public async Task ImportAsync(WorkflowDefinitionImportRequestDto input) { - if (input.File?.ContentLength == 0) - throw new ArgumentNullException(nameof(input.File)); + ArgumentNullException.ThrowIfNull(input); + ArgumentNullException.ThrowIfNull(input.File); + ArgumentNullException.ThrowIfNull(input.File.ContentLength); + ArgumentOutOfRangeException.ThrowIfLessThan(input.File.ContentLength.Value, 0, nameof(input.File)); var randomName = Path.GetFileNameWithoutExtension(Path.GetTempFileName()); var zipFilePath = Path.Combine(Path.GetTempPath(), "workflow", "import", $"{randomName}.zip"); diff --git a/src/Passingwind.Abp.ElsaModule.Application/WorkflowInstances/WorkflowInstanceAppService.cs b/src/Passingwind.Abp.ElsaModule.Application/WorkflowInstances/WorkflowInstanceAppService.cs index 692ccc74..a7d2b966 100644 --- a/src/Passingwind.Abp.ElsaModule.Application/WorkflowInstances/WorkflowInstanceAppService.cs +++ b/src/Passingwind.Abp.ElsaModule.Application/WorkflowInstances/WorkflowInstanceAppService.cs @@ -305,10 +305,7 @@ public async Task GetLogSummaryAsync(Gui public async Task GetStatusDateCountStatisticsAsync(WorkflowInstanceDateCountStatisticsRequestDto input) { var datePeriod = input.DatePeriod ?? 30; - if (datePeriod <= 0) - { - throw new ArgumentOutOfRangeException("datePeriod must > 0"); - } + ArgumentOutOfRangeException.ThrowIfLessThan(datePeriod, 0, nameof(input.DatePeriod)); double tz = input.Tz; diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowDefinitionManager.cs b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowDefinitionManager.cs index b919f750..56b158ae 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowDefinitionManager.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowDefinitionManager.cs @@ -66,8 +66,7 @@ public virtual Task CreateDefinitionAsync( public virtual Task CreateDefinitionVersionAsync(Guid definitionId, Guid? tenantId, List activities, List connections) { - if (activities == null) - throw new ArgumentNullException(nameof(activities)); + ArgumentNullException.ThrowIfNull(activities); var entity = new WorkflowDefinitionVersion(definitionId, tenantId, activities, connections); @@ -87,8 +86,7 @@ public virtual Task UpdateDefinitionAsync( Dictionary variables, Dictionary customAttributes) { - if (entity == null) - throw new ArgumentNullException(nameof(entity)); + ArgumentNullException.ThrowIfNull(entity); entity.DisplayName = displayName; entity.Channel = channel; diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowIdFilterSpecification.cs b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowIdFilterSpecification.cs index 74521ea4..d03acb09 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowIdFilterSpecification.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowIdFilterSpecification.cs @@ -19,6 +19,6 @@ public override Expression> ToExpression() { if (Ids?.Any() == true) return x => Ids.Contains(x.Id); - return x => true; + return _ => true; } } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowImporter.cs b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowImporter.cs index 220050c7..2b7ba4da 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowImporter.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowImporter.cs @@ -1,10 +1,10 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; using Passingwind.Abp.ElsaModule.Permissions; +using Volo.Abp.Authorization; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; @@ -50,17 +50,17 @@ public async Task ImportAsync(string jsonContent, bool overw // check permssion if (!await _workflowPermissionService.IsGrantedAsync(workflow.Id, ElsaModulePermissions.Definitions.Import, cancellationToken)) { - throw new Exception($"Workflow '{name}' unauthorized access."); + throw new AbpAuthorizationException($"Workflow '{name}' unauthorized access."); } if (!overwrite) { - throw new Exception($"Workflow '{name}' already exists."); + throw new AbpAuthorizationException($"Workflow '{name}' already exists."); } if (workflow.PublishedVersion > version) { - throw new Exception($"Workflow '{name}' import version '{version}' less then current version '{workflow.PublishedVersion}'."); + throw new AbpAuthorizationException($"Workflow '{name}' import version '{version}' less then current version '{workflow.PublishedVersion}'."); } } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowInstance.cs b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowInstance.cs index d8fac859..68aba46b 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowInstance.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Common/WorkflowInstance.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Elsa.Models; using Elsa.Services.Models; @@ -49,7 +49,7 @@ public WorkflowInstance(Guid id) : base(id) public WorkflowOutputReference Output { get; set; } - [Obsolete] + [Obsolete("Use Faults")] public WorkflowFault Fault { get; set; } public WorkflowInstanceScheduledActivity CurrentActivity { get; set; } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/RoleNameChangedEventHandler.cs b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/RoleNameChangedEventHandler.cs index 6af74904..74b8b7ac 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/RoleNameChangedEventHandler.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/RoleNameChangedEventHandler.cs @@ -6,11 +6,11 @@ namespace Passingwind.Abp.ElsaModule.EventHandlers; -public class RoleNameChangedEventHandler : IDistributedEventHandler, ITransientDependency +public class RoleNameChangedHandler : IDistributedEventHandler, ITransientDependency { protected IWorkflowTeamRepository WorkflowTeamRepository { get; } - public RoleNameChangedEventHandler(IWorkflowTeamRepository workflowTeamRepository) + public RoleNameChangedHandler(IWorkflowTeamRepository workflowTeamRepository) { WorkflowTeamRepository = workflowTeamRepository; } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowGroupLocalEventHandler.cs b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowGroupLocalEventHandler.cs index 10ca9a1a..3e891946 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowGroupLocalEventHandler.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowGroupLocalEventHandler.cs @@ -8,7 +8,7 @@ namespace Passingwind.Abp.ElsaModule.EventHandlers; -public class WorkflowGroupLocalEventHandler : +public class WorkflowGroupChangedHandler : ILocalEventHandler, ILocalEventHandler>, ITransientDependency, @@ -16,7 +16,7 @@ public class WorkflowGroupLocalEventHandler : { private readonly IWorkflowDefinitionRepository _workflowDefinitionRepository; - public WorkflowGroupLocalEventHandler(IWorkflowDefinitionRepository workflowDefinitionRepository) + public WorkflowGroupChangedHandler(IWorkflowDefinitionRepository workflowDefinitionRepository) { _workflowDefinitionRepository = workflowDefinitionRepository; } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowTeamEventHandler.cs b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowTeamEventHandler.cs index 4037a606..14cb7b4a 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowTeamEventHandler.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/EventHandlers/WorkflowTeamEventHandler.cs @@ -9,7 +9,7 @@ namespace Passingwind.Abp.ElsaModule.EventHandlers; -public class WorkflowTeamEventHandler : +public class WorkflowTeamChangedHandler : ILocalEventHandler>, ILocalEventHandler>, ILocalEventHandler>, @@ -19,7 +19,7 @@ public class WorkflowTeamEventHandler : private readonly PermissionManager _permissionManager; private readonly IWorkflowTeamManager _workflowTeamManager; - public WorkflowTeamEventHandler(PermissionManager permissionManager, IWorkflowTeamManager workflowTeamManager) + public WorkflowTeamChangedHandler(PermissionManager permissionManager, IWorkflowTeamManager workflowTeamManager) { _permissionManager = permissionManager; _workflowTeamManager = workflowTeamManager; diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Stores/ExpressionExtensions.cs b/src/Passingwind.Abp.ElsaModule.Domain/Stores/ExpressionExtensions.cs index e1f8e40e..b5013ddc 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Stores/ExpressionExtensions.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Stores/ExpressionExtensions.cs @@ -41,7 +41,7 @@ private static Expression ConvertType(this Expression fr return Expression.Lambda(body, newParams); } - private static ParameterExpression[] GenerateParameterMap(Expression from, IReadOnlyDictionary typeMap, IDictionary parameterMap) where TFrom : class + private static ParameterExpression[] GenerateParameterMap(Expression from, Dictionary typeMap, IDictionary parameterMap) where TFrom : class { var newParams = new ParameterExpression[from.Parameters.Count]; @@ -54,7 +54,7 @@ private static ParameterExpression[] GenerateParameterMap(Expression : ExpressionVisitor + private sealed class TypeConversionVisitor : ExpressionVisitor { private readonly Dictionary _parameterMap; diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Stores/Store.cs b/src/Passingwind.Abp.ElsaModule.Domain/Stores/Store.cs index 3ef3c1b6..bd0a306a 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Stores/Store.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Stores/Store.cs @@ -125,7 +125,7 @@ public virtual async Task FindAsync(ISpecification specification if (entity == null) { - Logger.LogWarning("The {0} entity was not found.", typeof(TModel)); + Logger.LogWarning($"The {typeof(TModel)} entity was not found."); return default; } diff --git a/src/Passingwind.Abp.ElsaModule.Domain/Stores/WorkflowInstanceFaultEqualityComparer.cs b/src/Passingwind.Abp.ElsaModule.Domain/Stores/WorkflowInstanceFaultEqualityComparer.cs index 5efd8710..a46afbb9 100644 --- a/src/Passingwind.Abp.ElsaModule.Domain/Stores/WorkflowInstanceFaultEqualityComparer.cs +++ b/src/Passingwind.Abp.ElsaModule.Domain/Stores/WorkflowInstanceFaultEqualityComparer.cs @@ -23,7 +23,7 @@ public int GetHashCode(WorkflowInstanceFault obj) return HashCode.Combine(obj.FaultedActivityId); } - new public bool Equals(object x, object y) + public new bool Equals(object x, object y) { if (x == y) { diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/GetCache.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/GetCache.cs index 79c286da..e8e13344 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/GetCache.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/GetCache.cs @@ -38,8 +38,7 @@ public GetCache(IDistributedCache distributedCache) protected override async ValueTask OnExecuteAsync(ActivityExecutionContext context) { - if (string.IsNullOrEmpty(Key)) - throw new ArgumentNullException(nameof(Key)); + ArgumentException.ThrowIfNullOrWhiteSpace(Key); var result = await _distributedCache.GetAsync(Key, token: context.CancellationToken); diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/RemoveCache.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/RemoveCache.cs index 0a81f745..3f68c3a7 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/RemoveCache.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/RemoveCache.cs @@ -35,8 +35,7 @@ public RemoveCache(IDistributedCache distributedCache) public override async ValueTask ExecuteAsync(ActivityExecutionContext context) { - if (string.IsNullOrEmpty(Key)) - throw new ArgumentNullException(nameof(Key)); + ArgumentException.ThrowIfNullOrWhiteSpace(Key); await _distributedCache.RemoveAsync(Key, token: context.CancellationToken); diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/SetCache.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/SetCache.cs index 9c9f4816..aee5029b 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/SetCache.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Caching/SetCache.cs @@ -48,8 +48,7 @@ public SetCache(IDistributedCache distributedCache) protected override async ValueTask OnExecuteAsync(ActivityExecutionContext context) { - if (string.IsNullOrEmpty(Key)) - throw new ArgumentNullException(nameof(Key)); + ArgumentException.ThrowIfNullOrWhiteSpace(Key); var options = new DistributedCacheEntryOptions(); diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Clocks/Clock.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Clocks/Clock.cs index 64be51d6..c147ec48 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Clocks/Clock.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Clocks/Clock.cs @@ -30,7 +30,7 @@ protected override IActivityExecutionResult OnExecute(ActivityExecutionContext c return Execute(); } - private IActivityExecutionResult Execute() + private OutcomeResult Execute() { Output = new ClockOutputModel { diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Configuration/ReadConfiguration.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Configuration/ReadConfiguration.cs index 0b53e4fc..641da991 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Configuration/ReadConfiguration.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Configuration/ReadConfiguration.cs @@ -40,7 +40,7 @@ protected override IActivityExecutionResult OnExecute(ActivityExecutionContext c return Execute(); } - private IActivityExecutionResult Execute() + private OutcomeResult Execute() { if (string.IsNullOrEmpty(Key)) throw new ArgumentNullException(nameof(Key)); diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Emailing/SendEmailV2.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Emailing/SendEmailV2.cs index df60799a..0f6fa69f 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Emailing/SendEmailV2.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Emailing/SendEmailV2.cs @@ -117,7 +117,7 @@ protected override async ValueTask OnExecuteAsync(Acti if (!string.IsNullOrEmpty(From)) message.From = new MailAddress(From); - if (OtherEmails?.Any() == true) + if (OtherEmails?.Count > 0) { foreach (var item in OtherEmails) { @@ -125,7 +125,7 @@ protected override async ValueTask OnExecuteAsync(Acti } } - if (ToUsers?.Any() == true) + if (ToUsers?.Count > 0) { foreach (var item in ToUsers) { @@ -135,7 +135,7 @@ protected override async ValueTask OnExecuteAsync(Acti } } - if (ToRoles?.Any() == true) + if (ToRoles?.Count > 0) { foreach (var item in ToRoles) { diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Primitives/Cancel.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Primitives/Cancel.cs index 8c28b0aa..d33ce8a7 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Primitives/Cancel.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Primitives/Cancel.cs @@ -1,4 +1,5 @@ -using Elsa.ActivityResults; +using System; +using Elsa.ActivityResults; using Elsa.Attributes; using Elsa.Expressions; using Elsa.Services; @@ -20,7 +21,7 @@ protected override IActivityExecutionResult OnExecute(ActivityExecutionContext c var message = Message ?? "Custom canceled"; context.JournalData.Add("Error", message); - context.WorkflowExecutionContext.Cancel(new System.Exception("Custom canceled."), message, context.ActivityBlueprint.Id, context.Input, context.Resuming); + context.WorkflowExecutionContext.Cancel(new OperationCanceledException("Custom canceled."), message, context.ActivityBlueprint.Id, context.Input, context.Resuming); return Noop(); } diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Scripting/RunCode.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Scripting/RunCode.cs index c5080749..3e9f92de 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Scripting/RunCode.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Scripting/RunCode.cs @@ -121,7 +121,7 @@ void ConfigureEngine(Engine engine) Output = await _javaScriptService.EvaluateAsync(codeContent, returnType, context, ConfigureEngine, context.CancellationToken); } - else if (entity.Language == GlobalCodeLanguage.Javascript) + else if (entity.Language == GlobalCodeLanguage.CSharp) { void configureGlobal(CSharpScriptEvaluationGlobal c) { diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Tenants/CurrentTenant.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Tenants/CurrentTenant.cs index 56c8b66a..b23f8596 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Tenants/CurrentTenant.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Tenants/CurrentTenant.cs @@ -31,7 +31,7 @@ protected override IActivityExecutionResult OnExecute(ActivityExecutionContext c return Execute(); } - private IActivityExecutionResult Execute() + private OutcomeResult Execute() { Output = new CurrentTenantOutputModel { diff --git a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Users/CurrentUser.cs b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Users/CurrentUser.cs index 989b7831..738ed80b 100644 --- a/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Users/CurrentUser.cs +++ b/src/Passingwind.Abp.ElsaModule.ElsaExtensions/Activities/Users/CurrentUser.cs @@ -19,7 +19,7 @@ public class CurrentUser : Activity [ActivityOutput(Hint = "The current user info.")] public CurrentUserOutputModel Output { get; set; } - public readonly ICurrentUser _currentUser; + private readonly ICurrentUser _currentUser; public CurrentUser(ICurrentUser currentUser) { @@ -31,7 +31,7 @@ protected override IActivityExecutionResult OnExecute(ActivityExecutionContext c return Execute(); } - private IActivityExecutionResult Execute() + private OutcomeResult Execute() { Output = new CurrentUserOutputModel() { diff --git a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreExtensions.cs b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreExtensions.cs index ee6c12e8..aa2a142f 100644 --- a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreExtensions.cs +++ b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreExtensions.cs @@ -1,7 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Query; - -namespace Passingwind.Abp.ElsaModule.EntityFrameworkCore; +namespace Passingwind.Abp.ElsaModule.EntityFrameworkCore; public static class EfCoreExtensions { diff --git a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs index 8d33d295..c0e7c34b 100644 --- a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs +++ b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/EfCoreJsonValueConverter.cs @@ -13,7 +13,11 @@ namespace Passingwind.Abp.ElsaModule.EntityFrameworkCore; public class EfCoreJsonValueConverter : ValueConverter { +#pragma warning disable CA2211 // Non-constant fields should not be visible +#pragma warning disable RCS1158 // Static member in generic type should use a type parameter public static Func CreateSettingsFunc; +#pragma warning restore RCS1158 // Static member in generic type should use a type parameter +#pragma warning restore CA2211 // Non-constant fields should not be visible static EfCoreJsonValueConverter() { diff --git a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/ElsaModuleDbContextModelCreatingExtensions.cs b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/ElsaModuleDbContextModelCreatingExtensions.cs index 339541eb..a5d3ed48 100644 --- a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/ElsaModuleDbContextModelCreatingExtensions.cs +++ b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/ElsaModuleDbContextModelCreatingExtensions.cs @@ -109,9 +109,9 @@ public static void ConfigureElsaModule(this ModelBuilder builder) b.Property(x => x.Input).HasConversion(new EfCoreJsonValueConverter(), ValueComparer.CreateDefault(typeof(Elsa.Services.Models.WorkflowInputReference), false)); b.Property(x => x.Output).HasConversion(new EfCoreJsonValueConverter(), ValueComparer.CreateDefault(typeof(Elsa.Services.Models.WorkflowOutputReference), false)); -#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete b.Property(x => x.Fault).HasConversion(new EfCoreJsonValueConverter(), ValueComparer.CreateDefault(typeof(Elsa.Models.WorkflowFault), false)); -#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete b.Property(x => x.CurrentActivity).HasConversion(new EfCoreJsonValueConverter(), ValueComparer.CreateDefault(typeof(WorkflowInstanceScheduledActivity), false)); //b.Property(x => x.ScheduledActivities).HasConversion(new ElsaEFJsonValueConverter>(), ValueComparer.CreateDefault(typeof(List), false)); diff --git a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/Repositories/GlobalCodeRepository.cs b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/Repositories/GlobalCodeRepository.cs index 856dba51..9e26620c 100644 --- a/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/Repositories/GlobalCodeRepository.cs +++ b/src/Passingwind.Abp.ElsaModule.EntityFrameworkCore/EntityFrameworkCore/Repositories/GlobalCodeRepository.cs @@ -66,7 +66,7 @@ public virtual async Task IsNameExistsAsync(string name, Guid[] excludeIds var dbset = await GetDbSetAsync(); return await dbset - .WhereIf(excludeIds?.Any() == true, x => !excludeIds.Contains(x.Id)) + .WhereIf(excludeIds?.Length > 0, x => !excludeIds.Contains(x.Id)) .AnyAsync(x => x.Name == name, cancellationToken: cancellationToken); } } diff --git a/src/Passingwind.Abp.ElsaModule.MongoDB/MongoDB/Repositories/GlobalCodeRepository.cs b/src/Passingwind.Abp.ElsaModule.MongoDB/MongoDB/Repositories/GlobalCodeRepository.cs index b7f26a12..c17c8ca9 100644 --- a/src/Passingwind.Abp.ElsaModule.MongoDB/MongoDB/Repositories/GlobalCodeRepository.cs +++ b/src/Passingwind.Abp.ElsaModule.MongoDB/MongoDB/Repositories/GlobalCodeRepository.cs @@ -72,7 +72,7 @@ public virtual async Task IsNameExistsAsync(string name, Guid[] excludeIds var query = await GetMongoQueryableAsync(); return await query - .WhereIf(excludeIds?.Any() == true, x => !excludeIds.Contains(x.Id)) + .WhereIf(excludeIds?.Length > 0, x => !excludeIds.Contains(x.Id)) .As>() .AnyAsync(x => x.Name == name, cancellationToken: cancellationToken); } diff --git a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharp/NuGetPackageService_Tests.cs b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharp/NuGetPackageService_Tests.cs index c8fbb14e..2718c705 100644 --- a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharp/NuGetPackageService_Tests.cs +++ b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharp/NuGetPackageService_Tests.cs @@ -1,5 +1,4 @@ using System.IO; -using System.Linq; using System.Threading.Tasks; using Passingwind.CSharpScriptEngine; using Shouldly; diff --git a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharpScriptHostTests.cs b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharpScriptHostTests.cs index b77984a8..aece2bfe 100644 --- a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharpScriptHostTests.cs +++ b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/CSharpScriptHostTests.cs @@ -20,9 +20,11 @@ public CSharpScriptHostTests() [Fact] public async Task CompileTest1() { - const string code = @"using System; + const string code = """ +using System; -Console.WriteLine(""Hello, World!"");" +Console.WriteLine("Hello, World!"); +""" ; var result = await _cSharpScriptHost.CompileAsync(new CSharpScriptCompileContext(_logger, code)); @@ -32,8 +34,10 @@ public async Task CompileTest1() [Fact] public async Task CompileTest2() { - const string code = @" -Console.WriteLine(""Hello, World!"");" + const string code = """ + +Console.WriteLine("Hello, World!"); +""" ; var result = await _cSharpScriptHost.CompileAsync(new CSharpScriptCompileContext(_logger, code)); @@ -43,12 +47,14 @@ public async Task CompileTest2() [Fact] public async Task CompileTest3() { - const string code = @" -#r ""nuget: Newtonsoft.Json, 13.0.3"" + const string code = """ + +#r "nuget: Newtonsoft.Json, 13.0.3" Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(new { a = 1 })); -" + +""" ; var result = await _cSharpScriptHost.CompileAsync(new CSharpScriptCompileContext(_logger, code)); @@ -58,13 +64,14 @@ public async Task CompileTest3() [Fact] public async Task CompileTest4() { - const string code = @" -#r ""System.Private.Uri"" + const string code = """ + +#r "System.Private.Uri" using System.IO; using System.Net; -var url = ""https://download.microsoft.com/download/4/C/8/4C830C0C-101F-4BF2-8FCB-32D9A8BA906A/Import_User_Sample_en.csv""; +var url = "https://download.microsoft.com/download/4/C/8/4C830C0C-101F-4BF2-8FCB-32D9A8BA906A/Import_User_Sample_en.csv"; var request = WebRequest.Create(url); var response = request.GetResponse(); var dataStream = response.GetResponseStream(); @@ -84,7 +91,8 @@ public async Task CompileTest4() foreach (var u in users) Console.WriteLine(u); -" + +""" ; var result = await _cSharpScriptHost.CompileAsync(new CSharpScriptCompileContext(_logger, code)); @@ -94,13 +102,14 @@ public async Task CompileTest4() [Fact] public async Task RunTest1() { - const string code = @" -#r ""System.Private.Uri"" + const string code = """ + +#r "System.Private.Uri" using System.IO; using System.Net; -var url = ""https://download.microsoft.com/download/4/C/8/4C830C0C-101F-4BF2-8FCB-32D9A8BA906A/Import_User_Sample_en.csv""; +var url = "https://download.microsoft.com/download/4/C/8/4C830C0C-101F-4BF2-8FCB-32D9A8BA906A/Import_User_Sample_en.csv"; var request = WebRequest.Create(url); var response = request.GetResponse(); var dataStream = response.GetResponseStream(); @@ -120,7 +129,8 @@ public async Task RunTest1() foreach (var u in users) Console.WriteLine(u); -" + +""" ; var _ = await _cSharpScriptHost.RunAsync(new CSharpScriptCompileContext(_logger, code)); } @@ -128,12 +138,14 @@ public async Task RunTest1() [Fact] public async Task RunTest2() { - const string code = @" -#r ""nuget: Newtonsoft.Json, 13.0.3"" + const string code = """ + +#r "nuget: Newtonsoft.Json, 13.0.3" return Newtonsoft.Json.JsonConvert.SerializeObject(new { a = 1 }); -" + +""" ; var result = await _cSharpScriptHost.RunAsync(new CSharpScriptCompileContext(_logger, code)); diff --git a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestBase.cs b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestBase.cs index bf052e13..2a4dc151 100644 --- a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestBase.cs +++ b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestBase.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Passingwind.Abp.ElsaModule; +namespace Passingwind.Abp.ElsaModule; public class ElsaModuleExtensionTestBase : ElsaModuleTestBase { diff --git a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestModule.cs b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestModule.cs index ca92c70b..dbe8a2c1 100644 --- a/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestModule.cs +++ b/test/Passingwind.Abp.ElsaModule.ElsaExtensionsTests/ElsaModuleExtensionTestModule.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Passingwind.CSharpScriptEngine; +using Passingwind.CSharpScriptEngine; using Volo.Abp.Modularity; namespace Passingwind.Abp.ElsaModule; diff --git a/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/ElsaModuleConsoleApiClientModule.cs b/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/ElsaModuleConsoleApiClientModule.cs index bf3552ae..9b5592da 100644 --- a/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/ElsaModuleConsoleApiClientModule.cs +++ b/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/ElsaModuleConsoleApiClientModule.cs @@ -11,5 +11,4 @@ namespace Passingwind.Abp.ElsaModule; )] public class ElsaModuleConsoleApiClientModule : AbpModule { - } diff --git a/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/Program.cs b/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/Program.cs index 5f368ed3..b8bcb47c 100644 --- a/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/test/Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp/Program.cs @@ -5,9 +5,9 @@ namespace Passingwind.Abp.ElsaModule.HttpApi.Client.ConsoleTestApp; -class Program +internal static class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } @@ -15,8 +15,5 @@ static async Task Main(string[] args) public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - }); + .ConfigureServices((hostContext, services) => services.AddHostedService()); } diff --git a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/ElsaModuleMongoDbTestModule.cs b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/ElsaModuleMongoDbTestModule.cs index 80a60ea7..acedbe03 100644 --- a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/ElsaModuleMongoDbTestModule.cs +++ b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/ElsaModuleMongoDbTestModule.cs @@ -1,7 +1,6 @@ using System; using Volo.Abp.Data; using Volo.Abp.Modularity; -using Volo.Abp.Uow; namespace Passingwind.Abp.ElsaModule.MongoDB; diff --git a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoDbFixture.cs b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoDbFixture.cs index 4239e28d..fc74c298 100644 --- a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoDbFixture.cs +++ b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoDbFixture.cs @@ -5,7 +5,7 @@ namespace Passingwind.Abp.ElsaModule.MongoDB; public class MongoDbFixture : IDisposable { - private static readonly MongoDbRunner MongoDbRunner; + public static readonly MongoDbRunner MongoDbRunner; public static readonly string ConnectionString; static MongoDbFixture() @@ -14,7 +14,9 @@ static MongoDbFixture() ConnectionString = MongoDbRunner.ConnectionString; } +#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize public void Dispose() +#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize { MongoDbRunner?.Dispose(); } diff --git a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoTestCollection.cs b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoTestCollection.cs index 284b4b77..89f7fc4b 100644 --- a/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoTestCollection.cs +++ b/test/Passingwind.Abp.ElsaModule.MongoDB.Tests/MongoDB/MongoTestCollection.cs @@ -3,7 +3,9 @@ namespace Passingwind.Abp.ElsaModule.MongoDB; [CollectionDefinition(Name)] +#pragma warning disable CA1711 // Identifiers should not have incorrect suffix public class MongoTestCollection : ICollectionFixture +#pragma warning restore CA1711 // Identifiers should not have incorrect suffix { public const string Name = "MongoDB Collection"; }