You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
3.9 KiB
121 lines
3.9 KiB
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Volo.Abp;
|
|
using Volo.Abp.AspNetCore.Mvc.Client;
|
|
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
|
|
using Volo.Abp.AspNetCore.Serilog;
|
|
using Volo.Abp.Auditing;
|
|
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
|
using Volo.Abp.Autofac;
|
|
using Volo.Abp.AutoMapper;
|
|
using Volo.Abp.BlobStoring;
|
|
using Volo.Abp.BlobStoring.Database;
|
|
using Volo.Abp.Caching.StackExchangeRedis;
|
|
using Volo.Abp.Http.Client;
|
|
using Volo.Abp.Http.Client.Authentication;
|
|
using Volo.Abp.Http.Client.IdentityModel.Web;
|
|
using Volo.Abp.Identity;
|
|
using Volo.Abp.Modularity;
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore;
|
|
using Volo.Abp.Swashbuckle;
|
|
using Volo.Abp.Timing;
|
|
using Volo.Abp.Users;
|
|
using Win_in.Sfs.Basedata.Application;
|
|
using Win_in.Sfs.Basedata.Domain;
|
|
using Win_in.Sfs.Basedata.EntityFrameworkCore;
|
|
using Win_in.Sfs.Basedata.HttpApi;
|
|
using Win_in.Sfs.FileStorage;
|
|
using Win_in.Sfs.FileStorage.Domain;
|
|
using Win_in.Sfs.Shared.Host;
|
|
|
|
namespace Win_in.Sfs.Basedata;
|
|
|
|
[DependsOn(
|
|
typeof(AbpIdentityHttpApiClientModule),
|
|
typeof(AbpAspNetCoreMvcClientModule),
|
|
typeof(AbpHttpClientIdentityModelWebModule),
|
|
typeof(SharedHostModule)
|
|
|
|
)]
|
|
//ABP
|
|
[DependsOn(
|
|
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
|
|
typeof(AbpAutofacModule),
|
|
typeof(AbpCachingStackExchangeRedisModule),
|
|
//typeof(AbpEntityFrameworkCoreMySQLModule),
|
|
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
|
|
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
|
|
typeof(AbpSettingManagementEntityFrameworkCoreModule),
|
|
typeof(AbpAspNetCoreSerilogModule),
|
|
typeof(AbpSwashbuckleModule),
|
|
typeof(AbpHttpClientModule),
|
|
typeof(AbpAutoMapperModule)
|
|
)]
|
|
//Basedata
|
|
[DependsOn(
|
|
typeof(BasedataApplicationModule),
|
|
typeof(BasedataEntityFrameworkCoreModule),
|
|
typeof(BasedataHttpApiModule)
|
|
)]
|
|
//FileStorage
|
|
[DependsOn(
|
|
typeof(FileStorageApplicationContractsModule)
|
|
)]
|
|
public class BasedataHttpApiHostModule : ModuleBase<BasedataHttpApiHostModule>
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
base.ConfigureServices(context);
|
|
ConfigureAuditing();
|
|
//
|
|
ConfigureBlobStoring();
|
|
Configure<AbpClockOptions>(options =>
|
|
{
|
|
options.Kind = DateTimeKind.Local;
|
|
});
|
|
}
|
|
|
|
public override void PostConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
// 这里必须手动替换一下
|
|
context.Services.Replace(ServiceDescriptor.Transient(typeof(IExternalUserLookupServiceProvider), typeof(HttpClientExternalUserLookupServiceProvider)));
|
|
context.Services.Replace(ServiceDescriptor.Transient<IRemoteServiceHttpClientAuthenticator, SfsHttpContextIdentityModelRemoteServiceHttpClientAuthenticator>());
|
|
}
|
|
|
|
protected override void ConfigureHttpClientProxies()
|
|
{
|
|
ServiceConfigurationContext.Services.AddHttpClientProxies(
|
|
typeof(FileStorageApplicationContractsModule).Assembly,
|
|
nameof(FileStorage)
|
|
);
|
|
}
|
|
|
|
protected override void ConfigureAuditing()
|
|
{
|
|
var basedataSelector = new NamedTypeSelector("BasedataSelector",
|
|
type => typeof(SfsBaseDataAggregateRootBase).IsAssignableFrom(type));
|
|
Configure<AbpAuditingOptions>(options =>
|
|
{
|
|
options.EntityHistorySelectors.Add(basedataSelector);
|
|
});
|
|
}
|
|
|
|
private void ConfigureBlobStoring()
|
|
{
|
|
Configure<AbpBlobStoringOptions>(options =>
|
|
{
|
|
options.Containers.Configure<FileStorageContainer>(container =>
|
|
{
|
|
container.UseDatabase();
|
|
});
|
|
});
|
|
}
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
|
{
|
|
CreateDatabase<BasedataDbContext>(context);
|
|
base.OnApplicationInitialization(context);
|
|
}
|
|
}
|
|
|