diff --git a/.editorconfig b/.editorconfig index 38ab141..ec5cf90 100644 --- a/.editorconfig +++ b/.editorconfig @@ -34,3 +34,8 @@ resharper_convert_to_primary_constructor_highlighting = none # 去除构造函 [*.xaml.cs] resharper_redundant_extends_list_entry_highlighting = none # 去除xaml.cs文件的基类型重复警告。基类型不能删除,否则编译报错。 + +[*.{cs,vb}] +# Organize usings +#按字母顺序对 System.* using 指令排序,并将它们放在其他 using 指令前面 +dotnet_sort_system_directives_first = true \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index e3bab0b..0989c2e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,7 +2,7 @@ true true - 8.1.14 + 8.1.15 diff --git a/Source/Starfish.Service/Domain/Aggregates/User.cs b/Source/Starfish.Service/Domain/Aggregates/User.cs index 438c879..b1ac5f1 100644 --- a/Source/Starfish.Service/Domain/Aggregates/User.cs +++ b/Source/Starfish.Service/Domain/Aggregates/User.cs @@ -106,7 +106,7 @@ private User(string userName, string passwordHash, string passwordSalt) /// internal static User Create(string userName, string password) { - var salt = RandomUtility.CreateUniqueId(); + var salt = RandomUtility.GenerateUniqueId(); var hash = Cryptography.DES.Encrypt(password, Encoding.UTF8.GetBytes(salt)); var entity = new User(userName, hash, salt); return entity; @@ -118,7 +118,7 @@ internal static User Create(string userName, string password) /// internal void ChangePassword(string password) { - var salt = RandomUtility.CreateUniqueId(); + var salt = RandomUtility.GenerateUniqueId(); var hash = Cryptography.DES.Encrypt(password, Encoding.UTF8.GetBytes(salt)); PasswordHash = hash; PasswordSalt = salt; diff --git a/Source/Starfish.Service/UseCases/Apps/AppInfoDeleteUseCase.cs b/Source/Starfish.Service/UseCases/Apps/AppInfoDeleteUseCase.cs index 1ff9028..743a5fb 100644 --- a/Source/Starfish.Service/UseCases/Apps/AppInfoDeleteUseCase.cs +++ b/Source/Starfish.Service/UseCases/Apps/AppInfoDeleteUseCase.cs @@ -9,7 +9,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 应用信息删除用例接口 /// -public interface IAppInfoDeleteUseCase : IUseCase; +public interface IAppInfoDeleteUseCase : INonOutputUseCase; /// /// 应用信息删除输入 @@ -25,23 +25,17 @@ public class AppInfoDeleteUseCase : IAppInfoDeleteUseCase /// /// 允许访问的角色 /// - private readonly string[] _roles = { "SA", "RW" }; + private readonly string[] _roles = ["SA", "RW"]; private readonly IBus _bus; private readonly UserPrincipal _user; - /// - /// 构造函数 - /// - /// - /// public AppInfoDeleteUseCase(IBus bus, UserPrincipal user) { _bus = bus; _user = user; } - /// public Task ExecuteAsync(AppInfoDeleteInput input, CancellationToken cancellationToken = default) { if (!_user.IsAuthenticated) diff --git a/Source/Starfish.Service/UseCases/Apps/AppInfoSetSecretUseCase.cs b/Source/Starfish.Service/UseCases/Apps/AppInfoSetSecretUseCase.cs index 017956f..9d2e7cb 100644 --- a/Source/Starfish.Service/UseCases/Apps/AppInfoSetSecretUseCase.cs +++ b/Source/Starfish.Service/UseCases/Apps/AppInfoSetSecretUseCase.cs @@ -4,7 +4,7 @@ namespace Nerosoft.Starfish.UseCases; -public interface IAppInfoSetSecretUseCase : IUseCase; +public interface IAppInfoSetSecretUseCase : INonOutputUseCase; public record AppInfoSetSecretInput(long Id, string Secret) : IUseCaseInput; diff --git a/Source/Starfish.Service/UseCases/Apps/AppInfoUpdateUseCase.cs b/Source/Starfish.Service/UseCases/Apps/AppInfoUpdateUseCase.cs index f66a96f..54c5262 100644 --- a/Source/Starfish.Service/UseCases/Apps/AppInfoUpdateUseCase.cs +++ b/Source/Starfish.Service/UseCases/Apps/AppInfoUpdateUseCase.cs @@ -10,7 +10,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 应用信息更新用例接口 /// -public interface IAppInfoUpdateUseCase : IUseCase; +public interface IAppInfoUpdateUseCase : INonOutputUseCase; /// /// 应用信息更新输入 @@ -32,18 +32,12 @@ public class AppInfoUpdateUseCase : IAppInfoUpdateUseCase private readonly IBus _bus; private readonly UserPrincipal _user; - /// - /// 构造函数 - /// - /// - /// public AppInfoUpdateUseCase(IBus bus, UserPrincipal user) { _bus = bus; _user = user; } - /// public Task ExecuteAsync(AppInfoUpdateInput input, CancellationToken cancellationToken = default) { if (!_user.IsAuthenticated) diff --git a/Source/Starfish.Service/UseCases/Apps/ChangeAppInfoStatusUseCase.cs b/Source/Starfish.Service/UseCases/Apps/ChangeAppInfoStatusUseCase.cs index 8e86099..6c5dd7e 100644 --- a/Source/Starfish.Service/UseCases/Apps/ChangeAppInfoStatusUseCase.cs +++ b/Source/Starfish.Service/UseCases/Apps/ChangeAppInfoStatusUseCase.cs @@ -10,7 +10,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 变更应用信息状态用例接口 /// -public interface IChangeAppInfoStatusUseCase : IUseCase; +public interface IChangeAppInfoStatusUseCase : INonOutputUseCase; /// /// 变更应用信息状态输入 @@ -27,23 +27,17 @@ public class ChangeAppInfoStatusUseCase : IChangeAppInfoStatusUseCase /// /// 允许访问的角色 /// - private readonly string[] _roles = { "SA", "RW" }; + private readonly string[] _roles = ["SA", "RW"]; private readonly IBus _bus; private readonly UserPrincipal _user; - /// - /// 构造函数 - /// - /// - /// public ChangeAppInfoStatusUseCase(IBus bus, UserPrincipal user) { _bus = bus; _user = user; } - /// public Task ExecuteAsync(ChangeAppInfoStatusInput input, CancellationToken cancellationToken = default) { if (!_user.IsAuthenticated) diff --git a/Source/Starfish.Service/UseCases/Identity/UserDeleteUseCase.cs b/Source/Starfish.Service/UseCases/Identity/UserDeleteUseCase.cs index 1198636..facf942 100644 --- a/Source/Starfish.Service/UseCases/Identity/UserDeleteUseCase.cs +++ b/Source/Starfish.Service/UseCases/Identity/UserDeleteUseCase.cs @@ -4,7 +4,7 @@ namespace Nerosoft.Starfish.UseCases; -public interface IUserDeleteUseCase : IUseCase; +public interface IUserDeleteUseCase : INonOutputUseCase; public record UserDeleteInput(int Id) : IUseCaseInput; diff --git a/Source/Starfish.Service/UseCases/Identity/UserSetRoleUseCase.cs b/Source/Starfish.Service/UseCases/Identity/UserSetRoleUseCase.cs index 17c3cb2..15e17e8 100644 --- a/Source/Starfish.Service/UseCases/Identity/UserSetRoleUseCase.cs +++ b/Source/Starfish.Service/UseCases/Identity/UserSetRoleUseCase.cs @@ -4,7 +4,7 @@ namespace Nerosoft.Starfish.UseCases; -public interface IUserSetRoleUseCase : IUseCase; +public interface IUserSetRoleUseCase : INonOutputUseCase; public record UserSetRoleInput(int Id, List Roles) : IUseCaseInput; diff --git a/Source/Starfish.Service/UseCases/Identity/UserUpdateUseCase.cs b/Source/Starfish.Service/UseCases/Identity/UserUpdateUseCase.cs index d6f9961..c6e9283 100644 --- a/Source/Starfish.Service/UseCases/Identity/UserUpdateUseCase.cs +++ b/Source/Starfish.Service/UseCases/Identity/UserUpdateUseCase.cs @@ -5,7 +5,7 @@ namespace Nerosoft.Starfish.UseCases; -public interface IUserUpdateUseCase : IUseCase; +public interface IUserUpdateUseCase : INonOutputUseCase; public record UserUpdateInput(int Id, UserUpdateDto Data) : IUseCaseInput; diff --git a/Source/Starfish.Service/UseCases/Setting/SettingNodeDeleteUseCase.cs b/Source/Starfish.Service/UseCases/Setting/SettingNodeDeleteUseCase.cs index 6d79a4d..89b3f66 100644 --- a/Source/Starfish.Service/UseCases/Setting/SettingNodeDeleteUseCase.cs +++ b/Source/Starfish.Service/UseCases/Setting/SettingNodeDeleteUseCase.cs @@ -7,7 +7,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 删除配置节点用例接口 /// -public interface ISettingNodeDeleteUseCase : IUseCase; +public interface ISettingNodeDeleteUseCase : INonOutputUseCase; /// /// 删除配置节点输入 @@ -22,16 +22,11 @@ public class SettingNodeDeleteUseCase : ISettingNodeDeleteUseCase { private readonly IBus _bus; - /// - /// 构造函数 - /// - /// public SettingNodeDeleteUseCase(IBus bus) { _bus = bus; } - /// public Task ExecuteAsync(SettingNodeDeleteInput input, CancellationToken cancellationToken = default) { var command = new SettingNodeDeleteCommand(input.Id); diff --git a/Source/Starfish.Service/UseCases/Setting/SettingNodePublishUseCase.cs b/Source/Starfish.Service/UseCases/Setting/SettingNodePublishUseCase.cs index 88f569b..c43e34c 100644 --- a/Source/Starfish.Service/UseCases/Setting/SettingNodePublishUseCase.cs +++ b/Source/Starfish.Service/UseCases/Setting/SettingNodePublishUseCase.cs @@ -1,7 +1,6 @@ using Nerosoft.Euonia.Application; using Nerosoft.Euonia.Bus; using Nerosoft.Starfish.Application; -using Nerosoft.Starfish.Domain; using Nerosoft.Starfish.Transit; namespace Nerosoft.Starfish.UseCases; @@ -9,7 +8,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 配置节点发布用例接口 /// -public interface ISettingNodePublishUseCase : IUseCase; +public interface ISettingNodePublishUseCase : INonOutputUseCase; /// /// 配置节点发布输入 @@ -23,20 +22,12 @@ public record SettingNodePublishInput(long Id, SettingNodePublishDto Data) : IUs public class SettingNodePublishUseCase : ISettingNodePublishUseCase { private readonly IBus _bus; - private readonly ISettingNodeRepository _repository; - /// - /// 构造函数 - /// - /// - /// - public SettingNodePublishUseCase(IBus bus, ISettingNodeRepository repository) + public SettingNodePublishUseCase(IBus bus) { _bus = bus; - _repository = repository; } - - /// + public async Task ExecuteAsync(SettingNodePublishInput input, CancellationToken cancellationToken = default) { var command = new SettingNodePublishCommand(input.Id); diff --git a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateDescriptionUseCase.cs b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateDescriptionUseCase.cs index 364d7c0..144abcb 100644 --- a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateDescriptionUseCase.cs +++ b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateDescriptionUseCase.cs @@ -7,7 +7,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 配置节点更新用例接口 /// -public interface ISettingNodeUpdateDescriptionUseCase : IUseCase; +public interface ISettingNodeUpdateDescriptionUseCase : INonOutputUseCase; /// /// 配置节点更新输入 @@ -23,16 +23,11 @@ public class SettingNodeUpdateDescriptionUseCase : ISettingNodeUpdateDescription { private readonly IBus _bus; - /// - /// 构造函数 - /// - /// public SettingNodeUpdateDescriptionUseCase(IBus bus) { _bus = bus; } - - /// + public Task ExecuteAsync(SettingNodeUpdateDescriptionInput valueInput, CancellationToken cancellationToken = default) { var command = new SettingNodeUpdateCommand(valueInput.Id, "description", valueInput.Description); diff --git a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateNameUseCase.cs b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateNameUseCase.cs index 513c979..5d0ea9a 100644 --- a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateNameUseCase.cs +++ b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateNameUseCase.cs @@ -7,7 +7,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 重命名配置节点用例接口 /// -public interface ISettingNodeUpdateNameUseCase : IUseCase; +public interface ISettingNodeUpdateNameUseCase : INonOutputUseCase; /// /// 重命名配置节点输入 @@ -32,7 +32,6 @@ public SettingNodeUpdateNameUseCase(IBus bus) _bus = bus; } - /// public Task ExecuteAsync(SettingNodeUpdateNameInput input, CancellationToken cancellationToken = default) { var command = new SettingNodeUpdateCommand(input.Id, "name", input.Name); diff --git a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateValueUseCase.cs b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateValueUseCase.cs index 5e191a8..8648d47 100644 --- a/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateValueUseCase.cs +++ b/Source/Starfish.Service/UseCases/Setting/SettingNodeUpdateValueUseCase.cs @@ -7,7 +7,7 @@ namespace Nerosoft.Starfish.UseCases; /// /// 配置节点更新用例接口 /// -public interface ISettingNodeUpdateValueUseCase : IUseCase; +public interface ISettingNodeUpdateValueUseCase : INonOutputUseCase; /// /// 配置节点更新输入 @@ -31,8 +31,7 @@ public SettingNodeUpdateValueUseCase(IBus bus) { _bus = bus; } - - /// + public Task ExecuteAsync(SettingNodeUpdateValueInput valueInput, CancellationToken cancellationToken = default) { var command = new SettingNodeUpdateCommand(valueInput.Id, "Value", valueInput.Value); diff --git a/Source/Starfish.Webapi/Starfish.Webapi.csproj b/Source/Starfish.Webapi/Starfish.Webapi.csproj index b5f44f0..25e7bc1 100644 --- a/Source/Starfish.Webapi/Starfish.Webapi.csproj +++ b/Source/Starfish.Webapi/Starfish.Webapi.csproj @@ -7,6 +7,7 @@ disable enable true + A lightweight powerful distributed configuration server for .NET application.