From 3b6f1a1289139dcb5c2aaa0882d1b34ce249370e Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 12 Nov 2025 15:58:22 +0800 Subject: [PATCH] feat: update template and cli --- .../LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj | 2 +- .../LINGYUN/Abp/Cli/Commands/CreateCommand.cs | 19 +------ .../LINGYUN/Abp/Cli/Commands/CreateOptions.cs | 6 --- .../Commands/LocalFileCreateProjectService.cs | 1 - .../Abp/Cli/Commands/ProjectCreateArgs.cs | 5 +- ...PackageName.CompanyName.ProjectName.csproj | 2 +- .../templates/micro/content/.gitignore | 11 ++++ .../content/.template.config/template.json | 25 --------- .../.template.config/template.zh-Hans.json | 1 - .../micro/content/Directory.Packages.props | 18 ++++--- .../PackageName.CompanyName.ProjectName.sln | 1 + .../templates/micro/content/common.props | 4 +- ...ompanyName.ProjectName.HttpApi.Host.csproj | 4 +- .../ProjectNameHttpApiHostModule.Configure.cs | 52 ++++++++++++++++++- .../ProjectNameHttpApiHostModule.cs | 10 +--- .../appsettings.Development.json | 9 +++- ...Name.DbMigrator.EntityFrameworkCore.csproj | 2 +- ...NameDbMigratorEntityFrameworkCoreModule.cs | 26 +--------- ....CompanyName.ProjectName.DbMigrator.csproj | 8 +-- .../appsettings.json | 8 ++- ...e.ProjectName.Application.Contracts.csproj | 1 + ...mpanyName.ProjectName.Domain.Shared.csproj | 1 + ...ame.CompanyName.ProjectName.HttpApi.csproj | 1 + 23 files changed, 106 insertions(+), 111 deletions(-) create mode 100644 aspnet-core/templates/micro/content/.gitignore diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj index cd2d2c76a..6494146ca 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj @@ -5,7 +5,7 @@ Exe net9.0 - 9.1.1 + 9.3.6 colin Use LINGYUN.MicroService.Templates command line true diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs index 32e678707..0573ac183 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs @@ -114,12 +114,6 @@ namespace LINGYUN.Abp.Cli.Commands Logger.LogInformation("DBMS: " + databaseManagementSystem); } - var telemetryProvider = GetTelemetryProvider(commandLineArgs); - if (!telemetryProvider.IsNullOrWhiteSpace()) - { - Logger.LogInformation("Telemetry provider: " + telemetryProvider); - } - var randomPort = string.IsNullOrWhiteSpace( commandLineArgs.Options.GetOrNull(CreateOptions.NoRandomPort.Short, CreateOptions.NoRandomPort.Long)); var applicationPort = randomPort ? RandomHelper.GetRandom(5001, 65535).ToString() : "5000"; @@ -172,8 +166,7 @@ namespace LINGYUN.Abp.Cli.Commands commandLineArgs.Options, connectionString, applicationPort, - daprPort, - telemetryProvider + daprPort ); await CreateProjectService.CreateAsync(projectArgs); @@ -204,7 +197,6 @@ namespace LINGYUN.Abp.Cli.Commands sb.AppendLine("-csf|--create-solution-folder (default: true)"); sb.AppendLine("-cs|--connection-string (your database connection string)"); sb.AppendLine("--dbms (your database management system)"); - sb.AppendLine("--tm (your telemetry provider, optional: SkyWalking、OpenTelemetry, default: OpenTelemetry)"); sb.AppendLine("--no-random-port (Use template's default ports)"); sb.AppendLine(""); sb.AppendLine("Examples:"); @@ -217,7 +209,6 @@ namespace LINGYUN.Abp.Cli.Commands sb.AppendLine(" labp create Acme.BookStore -csf false"); sb.AppendLine(" labp create Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\""); sb.AppendLine(" labp create Acme.BookStore --dbms mysql"); - sb.AppendLine(" labp create Acme.BookStore --tm SkyWalking"); sb.AppendLine(" labp create Acme.BookStore --connection-string \"Server=myServerName\\myInstanceName;Database=myDatabase;User Id=myUsername;Password=myPassword\""); sb.AppendLine(""); // TODO: 文档 @@ -232,14 +223,6 @@ namespace LINGYUN.Abp.Cli.Commands || commandLineArgs.Options.ContainsKey(NewCommand.Options.CreateSolutionFolder.Short); } - protected virtual string GetTelemetryProvider(CommandLineArgs commandLineArgs) - { - var provider = commandLineArgs.Options.GetOrNull( - CreateOptions.Telemetry.Short, - CreateOptions.Telemetry.Long); - return string.IsNullOrWhiteSpace(provider) ? "OpenTelemetry" : provider; - } - protected virtual DatabaseProvider GetDatabaseProvider(CommandLineArgs commandLineArgs) { var optionValue = commandLineArgs.Options.GetOrNull( diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs index a45892153..1a9941b97 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs @@ -21,11 +21,5 @@ public const string Short = "nrp"; public const string Long = "no-random-port"; } - - public static class Telemetry - { - public const string Short = "tm"; - public const string Long = "telemetry"; - } } } diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs index 81a0dd17e..bf89a4bd4 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs @@ -63,7 +63,6 @@ namespace LINGYUN.Abp.Cli.Commands commandBuilder.AppendFormat(" -n {0}", createArgs.SolutionName.ProjectName); commandBuilder.AppendFormat(" -o {0}", createArgs.OutputFolder); commandBuilder.AppendFormat(" --DatabaseManagement {0}", dbm); - commandBuilder.AppendFormat(" --Telemetry {0}", createArgs.TelemetryProvider); Logger.LogInformation("Execute command: " + commandBuilder.ToString()); diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs index a1c2120c3..0a3b72b5f 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs @@ -9,7 +9,6 @@ namespace LINGYUN.Abp.Cli.Commands public string PackageName { get; } public string ApplicationPort { get; } public string DaprPort { get; } - public string TelemetryProvider { get; } public ProjectCreateArgs( string packageName, SolutionName solutionName, @@ -27,8 +26,7 @@ namespace LINGYUN.Abp.Cli.Commands Dictionary extraProperties = null, string connectionString = null, string applicationPort = "5000", - string daprPort = "3500", - string telemetryProvider = "OpenTelemetry") + string daprPort = "3500") : base( solutionName, templateName, @@ -48,7 +46,6 @@ namespace LINGYUN.Abp.Cli.Commands PackageName = packageName; ApplicationPort = applicationPort; DaprPort = daprPort; - TelemetryProvider = telemetryProvider; } } } diff --git a/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj b/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj index 02a8a5e73..824a93685 100644 --- a/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj +++ b/aspnet-core/templates/micro/PackageName.CompanyName.ProjectName.csproj @@ -3,7 +3,7 @@ net9.0 true LINGYUN.Abp.MicroService.Templates - 9.2.0 + 9.3.6 colin.in@foxmail.com Abp framework micro-service template MIT diff --git a/aspnet-core/templates/micro/content/.gitignore b/aspnet-core/templates/micro/content/.gitignore new file mode 100644 index 000000000..fe3ea0306 --- /dev/null +++ b/aspnet-core/templates/micro/content/.gitignore @@ -0,0 +1,11 @@ +.vs +bin +obj +logs +LocalNuget +Modules +TestResults +appsettings.Development.json +appsettings.Staging.json +appsettings.Production.json + diff --git a/aspnet-core/templates/micro/content/.template.config/template.json b/aspnet-core/templates/micro/content/.template.config/template.json index 4c1933a55..b219fab88 100644 --- a/aspnet-core/templates/micro/content/.template.config/template.json +++ b/aspnet-core/templates/micro/content/.template.config/template.json @@ -30,23 +30,6 @@ "sourceName": "ProjectName", "preferNameDirectory": true, "symbols": { - "Telemetry": { - "type": "parameter", - "description": "Distributed tracking provider", - "datatype": "choice", - "defaultValue": "OpenTelemetry", - "isRequired": false, - "choices": [ - { - "choice": "SkyWalking", - "description": "Use SkyWalking" - }, - { - "choice": "OpenTelemetry", - "description": "Use OpenTelemetry" - } - ] - }, "DatabaseManagement": { "type": "parameter", "description": "Database Management", @@ -103,14 +86,6 @@ "PostgreSql": { "type": "computed", "value": "(DatabaseManagement == \"PostgreSql\")" - }, - "SkyWalking": { - "type": "computed", - "value": "(Telemetry == \"SkyWalking\")" - }, - "OpenTelemetry": { - "type": "computed", - "value": "(Telemetry == \"OpenTelemetry\")" } } } diff --git a/aspnet-core/templates/micro/content/.template.config/template.zh-Hans.json b/aspnet-core/templates/micro/content/.template.config/template.zh-Hans.json index b97348a97..a71edaf62 100644 --- a/aspnet-core/templates/micro/content/.template.config/template.zh-Hans.json +++ b/aspnet-core/templates/micro/content/.template.config/template.zh-Hans.json @@ -1,5 +1,4 @@ { "description": "适用于abp框架的微服务模板项目", - "symbols/Telemetry/description": "微服务追踪提供者, 可选项为: SkyWalking、OpenTelemetry, 默认使用OpenTelemetry.", "symbols/DatabaseManagement/description": "数据库管理提供者, 可选项为: SqlServer、MySQL、Sqlite、Oracle、OracleDevart、PostgreSql, 默认使用MySQL." } diff --git a/aspnet-core/templates/micro/content/Directory.Packages.props b/aspnet-core/templates/micro/content/Directory.Packages.props index a97bfb3e2..de3aa0208 100644 --- a/aspnet-core/templates/micro/content/Directory.Packages.props +++ b/aspnet-core/templates/micro/content/Directory.Packages.props @@ -2,11 +2,11 @@ 8.3.5 2.15.1 - 9.2.0 - 9.2.0 - 9.0.4 - 9.0.4 - 9.0.4 + 9.3.6 + 9.3.6 + 9.0.5 + 9.0.5 + 9.0.5 true @@ -243,7 +243,7 @@ - + @@ -290,6 +290,7 @@ + @@ -391,8 +392,9 @@ - - + + + diff --git a/aspnet-core/templates/micro/content/PackageName.CompanyName.ProjectName.sln b/aspnet-core/templates/micro/content/PackageName.CompanyName.ProjectName.sln index 30ec3bf70..86f0bf749 100644 --- a/aspnet-core/templates/micro/content/PackageName.CompanyName.ProjectName.sln +++ b/aspnet-core/templates/micro/content/PackageName.CompanyName.ProjectName.sln @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.Pro EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solution Items", "{C9675742-7986-4BC1-9781-FD1C3C5B6287}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore common.props = common.props configureawait.props = configureawait.props Directory.Build.props = Directory.Build.props diff --git a/aspnet-core/templates/micro/content/common.props b/aspnet-core/templates/micro/content/common.props index 3c49ad117..76c45eb0d 100644 --- a/aspnet-core/templates/micro/content/common.props +++ b/aspnet-core/templates/micro/content/common.props @@ -1,12 +1,12 @@ latest - 9.2.0 + 9.3.6 colin $(NoWarn);CS1591;CS0436;CS8618;NU1803 https://github.com/colinin/abp-next-admin $(SolutionDir)LocalNuget - 9.2.0 + 9.3.6 MIT git https://github.com/colinin/abp-next-admin diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj index f58692a52..707c379d7 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj @@ -31,8 +31,8 @@ - - + + diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs index 6faf74c7d..eedb595cf 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs @@ -24,6 +24,7 @@ using Microsoft.OpenApi.Models; using StackExchange.Redis; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text.Encodings.Web; using System.Text.Unicode; @@ -328,9 +329,35 @@ public partial class ProjectNameHttpApiHostModule }, options => { - options.SwaggerDoc("v1", new OpenApiInfo { Title = "ProjectName API", Version = "v1" }); + options.SwaggerDoc("v1", new OpenApiInfo + { + Title = "ProjectName API", + Version = "v1", + Contact = new OpenApiContact + { + Name = "anonymous", // your name + Email = "anonymous@gmail.com", // your email + Url = new Uri("http://localhost/profile") // your profile + }, + License = new OpenApiLicense + { + Name = "MIT", + Url = new Uri("https://licenses.nuget.org/MIT") + } + }); options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(type => type.FullName); + options.DescribeAllParametersInCamelCase(); + options.TagActionsBy(api => + { + // 控制器分组显示 + var groupName = api.GroupName ?? "未分组"; + var controllerName = api.ActionDescriptor.RouteValues["controller"]; + + // 使用控制器名称和摘要信息创建分组 + return new[] { $"{groupName}/{controllerName}" }; + }); + options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", @@ -340,6 +367,7 @@ public partial class ProjectNameHttpApiHostModule Type = SecuritySchemeType.Http, BearerFormat = "JWT" }); + options.AddSecurityRequirement(new OpenApiSecurityRequirement { { @@ -350,6 +378,15 @@ public partial class ProjectNameHttpApiHostModule new string[] { } } }); + + var currentPath = AppContext.BaseDirectory; + var xmlDocFiles = Directory.GetFiles(currentPath, "PackageName.CompanyName.ProjectName.*.xml"); + + foreach (var xmlDocFile in xmlDocFiles) + { + options.IncludeXmlComments(xmlDocFile); + } + options.OperationFilter(); options.HideAbpEndpoints(); }); @@ -393,6 +430,14 @@ public partial class ProjectNameHttpApiHostModule // options.AutoValidateFilter = (type) => !type.Namespace.Contains("elsa", StringComparison.CurrentCultureIgnoreCase); }); + if (isDevelopment) + { + // 开发环境可以取消注释禁用权限检查 + // services.AddAlwaysAllowAuthorization(); + // 开发环境可以取消注释禁用会话检查 + // services.AddAlwaysAllowSession(); + } + services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddAbpJwtBearer(options => { @@ -404,6 +449,11 @@ public partial class ProjectNameHttpApiHostModule options.TokenValidationParameters.ValidIssuers = validIssuers; options.TokenValidationParameters.IssuerValidator = TokenWildcardIssuerValidator.IssuerValidator; } + var validAudiences = configuration.GetSection("AuthServer:ValidAudiences").Get>(); + if (validAudiences?.Count > 0) + { + options.TokenValidationParameters.ValidAudiences = validAudiences; + } }); if (!isDevelopment) diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs index 6a109ba14..0087fc9c8 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs @@ -12,11 +12,8 @@ using LINGYUN.Abp.Saas.EntityFrameworkCore; using LINGYUN.Abp.Serilog.Enrichers.Application; using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Sms.Platform; -#if SkyWalking using LINGYUN.Abp.Telemetry.SkyWalking; -#elif OpenTelemetry using LINGYUN.Abp.Telemetry.OpenTelemetry; -#endif using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -45,6 +42,7 @@ namespace PackageName.CompanyName.ProjectName; typeof(AbpSerilogEnrichersUniqueIdModule), typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAspNetCoreSerilogModule), + typeof(AbpCAPEventBusModule), typeof(ProjectNameApplicationModule), typeof(ProjectNameHttpApiModule), @@ -52,7 +50,6 @@ namespace PackageName.CompanyName.ProjectName; typeof(ProjectNameDbMigratorEntityFrameworkCoreModule), typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpCAPEventBusModule), typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpAspNetCoreMultiTenancyModule), @@ -69,13 +66,10 @@ namespace PackageName.CompanyName.ProjectName; typeof(AbpAspNetCoreMvcWrapperModule), typeof(AbpAspNetCoreHttpOverridesModule), typeof(AbpIdentitySessionAspNetCoreModule), -#if SkyWalking typeof(AbpTelemetrySkyWalkingModule), -#elif OpenTelemetry typeof(AbpTelemetryOpenTelemetryModule), -#endif - typeof(AbpClaimsMappingModule), typeof(AbpExporterMiniExcelModule), + typeof(AbpClaimsMappingModule), typeof(AbpEmailingPlatformModule), typeof(AbpSmsPlatformModule), typeof(AbpSwashbuckleModule), diff --git a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json index b1acf940c..6ad910b64 100644 --- a/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json +++ b/aspnet-core/templates/micro/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json @@ -26,8 +26,13 @@ }, "ConnectionStrings": { "Default": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "Business": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "Framework": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" + "AbpSaas": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpTenantManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpSettingManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpPermissionManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpFeatureManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpTextTemplating": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpLocalizationManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" }, "DistributedLock": { "IsEnabled": true, diff --git a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore.csproj b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore.csproj index 4ad9120e0..63430c7af 100644 --- a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore.csproj +++ b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore.csproj @@ -17,7 +17,7 @@ - + diff --git a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/ProjectNameDbMigratorEntityFrameworkCoreModule.cs b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/ProjectNameDbMigratorEntityFrameworkCoreModule.cs index 5c512d9f8..823981a7f 100644 --- a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/ProjectNameDbMigratorEntityFrameworkCoreModule.cs +++ b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator.EntityFrameworkCore/ProjectNameDbMigratorEntityFrameworkCoreModule.cs @@ -27,7 +27,7 @@ namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; typeof(ProjectNameEntityFrameworkCoreModule), typeof(AbpSaasEntityFrameworkCoreModule), #if MySQL - typeof(AbpEntityFrameworkCoreMySQLModule), + typeof(AbpEntityFrameworkCoreMySQLPomeloModule), #elif SqlServer typeof(AbpEntityFrameworkCoreSqlServerModule), #elif Sqlite @@ -45,30 +45,6 @@ public class ProjectNameDbMigratorEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - // 配置连接字符串 - Configure(options => - { - // 业务数据库 - options.Databases.Configure("ProjectName", database => - { - database.MapConnection( - "ProjectName" - ); - }); - // abp框架数据库 - options.Databases.Configure("Framework", database => - { - database.MapConnection( - "AbpSaas", - "AbpTextTemplating", - "AbpSettingManagement", - "AbpFeatureManagement", - "AbpPermissionManagement", - "AbpLocalizationManagement" - ); - }); - }); - // 配置Ef Configure(options => { diff --git a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj index 68c623786..8c3dc8a4f 100644 --- a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj +++ b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj @@ -27,13 +27,13 @@ - + - - PreserveNewest - + + PreserveNewest + diff --git a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json index 5664c692f..331b315cc 100644 --- a/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json +++ b/aspnet-core/templates/micro/content/migrations/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json @@ -1,7 +1,13 @@ { "ConnectionStrings": { "ProjectName": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "Framework": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" + "AbpSaas": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpTenantManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpSettingManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpPermissionManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpFeatureManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpTextTemplating": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", + "AbpLocalizationManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" }, "DistributedLock": { "IsEnabled": true, diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj index ea27644d7..ed430391f 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj @@ -10,6 +10,7 @@ false false false + True enable diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj index 58e1c6ee8..63d82853c 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj @@ -10,6 +10,7 @@ false false false + True enable diff --git a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj index 47d45662f..d0e168f03 100644 --- a/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj +++ b/aspnet-core/templates/micro/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj @@ -10,6 +10,7 @@ false false false + True enable