|
|
|
@ -1,9 +1,9 @@ |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions; |
|
|
|
using Microsoft.OpenApi.Models; |
|
|
|
using MyCompanyName.MyProjectName.Data; |
|
|
|
using MyCompanyName.MyProjectName.Localization; |
|
|
|
using StackExchange.Redis; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Account; |
|
|
|
using Volo.Abp.Account.Web; |
|
|
|
@ -19,7 +19,7 @@ using Volo.Abp.AspNetCore.Serilog; |
|
|
|
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Autofac; |
|
|
|
using Volo.Abp.AutoMapper; |
|
|
|
using Volo.Abp.Caching.StackExchangeRedis; |
|
|
|
using Volo.Abp.Emailing; |
|
|
|
using Volo.Abp.EntityFrameworkCore; |
|
|
|
using Volo.Abp.EntityFrameworkCore.SqlServer; |
|
|
|
using Volo.Abp.FeatureManagement; |
|
|
|
@ -53,7 +53,6 @@ namespace MyCompanyName.MyProjectName; |
|
|
|
typeof(AbpAspNetCoreMultiTenancyModule), |
|
|
|
typeof(AbpAutofacModule), |
|
|
|
typeof(AbpAutoMapperModule), |
|
|
|
typeof(AbpCachingStackExchangeRedisModule), |
|
|
|
typeof(AbpEntityFrameworkCoreSqlServerModule), |
|
|
|
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|
|
|
typeof(AbpSwashbuckleModule), |
|
|
|
@ -115,6 +114,11 @@ public class MyProjectNameModule : AbpModule |
|
|
|
{ |
|
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
if (hostingEnvironment.IsDevelopment()) |
|
|
|
{ |
|
|
|
context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>()); |
|
|
|
} |
|
|
|
|
|
|
|
ConfigureBundles(); |
|
|
|
ConfigureMultiTenancy(); |
|
|
|
@ -126,7 +130,7 @@ public class MyProjectNameModule : AbpModule |
|
|
|
ConfigureLocalization(); |
|
|
|
ConfigureAuthentication(context.Services, configuration); |
|
|
|
ConfigureCors(context, configuration); |
|
|
|
ConfigureDataProtection(context, configuration, hostingEnvironment); |
|
|
|
ConfigureDataProtection(context); |
|
|
|
ConfigureEfCore(context); |
|
|
|
} |
|
|
|
|
|
|
|
@ -278,17 +282,9 @@ public class MyProjectNameModule : AbpModule |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureDataProtection( |
|
|
|
ServiceConfigurationContext context, |
|
|
|
IConfiguration configuration, |
|
|
|
IWebHostEnvironment hostingEnvironment) |
|
|
|
private void ConfigureDataProtection(ServiceConfigurationContext context) |
|
|
|
{ |
|
|
|
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName"); |
|
|
|
if (!hostingEnvironment.IsDevelopment()) |
|
|
|
{ |
|
|
|
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); |
|
|
|
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys"); |
|
|
|
} |
|
|
|
context.Services.AddDataProtection().SetApplicationName("MyProjectName"); |
|
|
|
} |
|
|
|
|
|
|
|
private void ConfigureEfCore(ServiceConfigurationContext context) |
|
|
|
|