Abp Vnext 的 Vue3 实现版本
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.
 
 
 
 
 
 

42 lines
1.5 KiB

using Microsoft.AspNetCore.Identity;
using MyCompanyName.MyProjectName.MyModuleName;
#pragma warning disable CS0618 // Type or member is obsolete
namespace Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionExtensions
{
/// <summary>
/// 注册Redis缓存
/// </summary>
public static IServiceCollection AddAbpProRedis(this IServiceCollection service)
{
service.Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "AbpPro:"; });
var configuration = service.GetConfiguration();
var redis = ConnectionMultiplexer.Connect(configuration.GetValue<string>("Redis:Configuration"));
service
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "AbpPro-Protection-Keys");
return service;
}
/// <summary>
/// 配置虚拟文件系统
/// </summary>
public static IServiceCollection AddAbpProVirtualFileSystem(this IServiceCollection service)
{
service.Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<MyModuleNameHttpApiHostModule>();
});
return service;
}
public static IServiceCollection AddAbpProDbContext(this IServiceCollection service)
{
service.Configure<AbpDbContextOptions>(options => { options.UseNpgsql(builder => { builder.TranslateParameterizedCollectionsToConstants(); }); });
return service;
}
}