diff --git a/Yes.Application/Admins/Installs/FileService.cs b/Yes.Application/Installs/FileService.cs similarity index 93% rename from Yes.Application/Admins/Installs/FileService.cs rename to Yes.Application/Installs/FileService.cs index 12e3c16..3333535 100644 --- a/Yes.Application/Admins/Installs/FileService.cs +++ b/Yes.Application/Installs/FileService.cs @@ -1,7 +1,6 @@ - -namespace Yes.Application.Admins.Installs +namespace Yes.Application.Installs { - public class FileService:IFileService + public class FileService : IFileService { public void CopyFolder(string sources, string dest) { diff --git a/Yes.Application/Admins/Installs/InstallCommandHandler.cs b/Yes.Application/Installs/InstallCommandHandler.cs similarity index 90% rename from Yes.Application/Admins/Installs/InstallCommandHandler.cs rename to Yes.Application/Installs/InstallCommandHandler.cs index b2386ac..f630f8b 100644 --- a/Yes.Application/Admins/Installs/InstallCommandHandler.cs +++ b/Yes.Application/Installs/InstallCommandHandler.cs @@ -1,22 +1,21 @@ -namespace Yes.Application.Admins.Installs +namespace Yes.Application.Installs { public record InstallCommand( string DatabaseType, string DatabaseServer, - string DatabaseVersion, string DatabaseUser, string DatabasePassword, string DatabaseName, bool UseDefaultAdmin ) : IRequest; - public record InstallCommandResponse(bool Success,string ErrorMessage=""); + public record InstallCommandResponse(bool Success, string ErrorMessage = ""); public class InstallCommandHandler( - IConnectionStringProvider connectionStringProvider, - IMigratorProvider migratorProvider, + IConnectionStringProvider connectionStringProvider, + IMigratorProvider migratorProvider, IWebHostEnvironment env, - IConfigurationService configurationService, + IConfigurationService configurationService, IFileService fileService, IOptionsMonitor options) : IRequestHandler { diff --git a/Yes.Application/Yes.Application.csproj b/Yes.Application/Yes.Application.csproj index fde385a..0103473 100644 --- a/Yes.Application/Yes.Application.csproj +++ b/Yes.Application/Yes.Application.csproj @@ -13,7 +13,7 @@ - + diff --git a/Yes.Blog/Areas/Install/Pages/Index.cshtml b/Yes.Blog/Areas/Install/Pages/Index.cshtml index 3d7a339..26ef921 100644 --- a/Yes.Blog/Areas/Install/Pages/Index.cshtml +++ b/Yes.Blog/Areas/Install/Pages/Index.cshtml @@ -91,10 +91,6 @@ -
- - -
@@ -105,7 +101,7 @@
- +
diff --git a/Yes.Blog/Endpoints/Blogs/InstallEndpoint.cs b/Yes.Blog/Endpoints/Blogs/InstallEndpoint.cs index 11d9226..1cfe9f9 100644 --- a/Yes.Blog/Endpoints/Blogs/InstallEndpoint.cs +++ b/Yes.Blog/Endpoints/Blogs/InstallEndpoint.cs @@ -1,5 +1,7 @@  +using Yes.Application.Installs; + namespace Yes.Blog.Endpoints.Blogs { public class InstallEndpoint : BlogEndpointScheme, IEndpoint @@ -9,7 +11,6 @@ namespace Yes.Blog.Endpoints.Blogs public record Request( string DatabaseType, string DatabaseServer, - string DatabaseVersion, string DatabaseUser, string DatabasePassword, string DatabaseName, diff --git a/Yes.Blog/GlobalUsings.cs b/Yes.Blog/GlobalUsings.cs index 901a74b..fc533c4 100644 --- a/Yes.Blog/GlobalUsings.cs +++ b/Yes.Blog/GlobalUsings.cs @@ -18,7 +18,6 @@ global using Yes.Application.Admins.Auths; global using Yes.Application.Admins.Categories; global using Yes.Application.Admins.Comments; global using Yes.Application.Admins.Configurations; -global using Yes.Application.Admins.Installs; global using Yes.Application.Admins.Pages; global using Yes.Application.Admins.Statistics; global using Yes.Application.Admins.Storages; diff --git a/Yes.Blog/Yes.Blog.csproj b/Yes.Blog/Yes.Blog.csproj index 6bedb1d..ee56d38 100644 --- a/Yes.Blog/Yes.Blog.csproj +++ b/Yes.Blog/Yes.Blog.csproj @@ -40,11 +40,11 @@ - - + + - - + + diff --git a/Yes.Domain/Configurations/BlogSettings.cs b/Yes.Domain/Configurations/BlogSettings.cs index f1754b6..b92f442 100644 --- a/Yes.Domain/Configurations/BlogSettings.cs +++ b/Yes.Domain/Configurations/BlogSettings.cs @@ -8,7 +8,6 @@ public string DatabaseType { get; set; } - public string DatabaseVersion { get; set; } public string Name { get; set; } = "我的博客"; diff --git a/Yes.Domain/Core/Data/IConnectionStringProvider.cs b/Yes.Domain/Core/Data/IConnectionStringProvider.cs index 5bd4f71..112e1c5 100644 --- a/Yes.Domain/Core/Data/IConnectionStringProvider.cs +++ b/Yes.Domain/Core/Data/IConnectionStringProvider.cs @@ -8,7 +8,6 @@ namespace Yes.Domain.Core.Data DatabaseTypeEnum GetDatabaseType(); - string GetDatabaseVersion(); string GetConnectionStringWithoutDatabase(DatabaseTypeEnum databaseType, string connectionString); diff --git a/Yes.Domain/Yes.Domain.csproj b/Yes.Domain/Yes.Domain.csproj index 7441078..2acec46 100644 --- a/Yes.Domain/Yes.Domain.csproj +++ b/Yes.Domain/Yes.Domain.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/Yes.Infrastructure/Data/ConnectionStringBuilders/ConnectionStringProvider.cs b/Yes.Infrastructure/Data/ConnectionStringBuilders/ConnectionStringProvider.cs index ddc5b5e..93c982a 100644 --- a/Yes.Infrastructure/Data/ConnectionStringBuilders/ConnectionStringProvider.cs +++ b/Yes.Infrastructure/Data/ConnectionStringBuilders/ConnectionStringProvider.cs @@ -29,11 +29,6 @@ return databaseType; } - public string GetDatabaseVersion() - { - return _settings.DatabaseVersion; - } - public string GetConnectionStringWithoutDatabase(DatabaseTypeEnum databaseType, string connectionString) { var builder = ConnectionStringBuilderFactory.CreateStringBuilder(databaseType, connectionString); diff --git a/Yes.Infrastructure/Data/DbContexts/BlogDbContext.cs b/Yes.Infrastructure/Data/DbContexts/BlogDbContext.cs index 1944e6f..0d935be 100644 --- a/Yes.Infrastructure/Data/DbContexts/BlogDbContext.cs +++ b/Yes.Infrastructure/Data/DbContexts/BlogDbContext.cs @@ -5,14 +5,12 @@ private readonly string _connectionString; private readonly DatabaseTypeEnum _databaseType; - private readonly string _databaseVersion; public BlogDbContext(IConnectionStringProvider connectionStringProvider) { _connectionString = connectionStringProvider.GetConnectionString(); _databaseType = connectionStringProvider.GetDatabaseType(); - _databaseVersion = connectionStringProvider.GetDatabaseVersion(); } @@ -22,7 +20,7 @@ _ = _databaseType switch { DatabaseTypeEnum.SqlServer => builder.UseSqlServer(_connectionString), - DatabaseTypeEnum.MySql => builder.UseMySql(_connectionString, string.IsNullOrEmpty(_databaseVersion) ? MySqlServerVersion.AutoDetect(_connectionString) : new MySqlServerVersion(_databaseVersion)), + DatabaseTypeEnum.MySql => builder.UseMySql(_connectionString, MySqlServerVersion.AutoDetect(_connectionString)), DatabaseTypeEnum.PostgreSQL => builder.UseNpgsql(_connectionString), _ => throw new DatabaseNotSupportedException() diff --git a/Yes.Infrastructure/Yes.Infrastructure.csproj b/Yes.Infrastructure/Yes.Infrastructure.csproj index 89513ce..07ae55d 100644 --- a/Yes.Infrastructure/Yes.Infrastructure.csproj +++ b/Yes.Infrastructure/Yes.Infrastructure.csproj @@ -7,15 +7,15 @@ - - - - - - - + + + + + + + - +