public static HuskyServiceHub AddMailSender <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, IMailDbContext { husky.Services.AddDbContext <IMailDbContext, TDbContext>(); husky.Services.AddScoped <IMailSender, MailSender>(); return(husky); }
public static HuskyServiceHub AddDiagnostics <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, IDiagnosticsDbContext { husky.Services.AddDbContext <IDiagnosticsDbContext, TDbContext>(); husky.Services.AddScoped <IDiagnosticsLogger, DiagnosticsLogger>(); return(husky); }
public static HuskyServiceHub AddKeyValueManager <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, IKeyValueDbContext { husky.Services.AddDbContext <IKeyValueDbContext, TDbContext>(); husky.Services.AddSingleton <IKeyValueManager, KeyValueManager>(); return(husky); }
public static HuskyServiceHub AddFileStoreLogger <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, IFileStoreDbContext { husky.Services.AddDbContext <IFileStoreDbContext, TDbContext>(); husky.Services.AddScoped <IFileStoreLogger, FileStoreLogger>(); return(husky); }
public static HuskyServiceHub AddTwoFactor(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services .AddDbContextPool <ITwoFactorDbContext, TwoFactorDbContext>(optionsAction) .AddScoped <ITwoFactorManager, TwoFactorManager>(); return(husky); }
public static HuskyServiceHub AddPrincipalAdmin <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, IAdminsDbContext { husky.Services.AddDbContext <IAdminsDbContext, TDbContext>(); husky.Services.AddScoped <IPrincipalAdmin, PrincipalAdmin>(); return(husky); }
public static HuskyServiceHub AddAliyunSms(this HuskyServiceHub husky, Action <AliyunSmsOptions> setupAction) { var options = new AliyunSmsOptions(); setupAction(options); husky.Services.AddSingleton <ISmsSender>(new AliyunSmsSender(options)); return(husky); }
public static HuskyServiceHub AddTwoFactor <TDbContext>(this HuskyServiceHub husky) where TDbContext : DbContext, ITwoFactorDbContext { husky.Services .AddDbContext <ITwoFactorDbContext, TDbContext>() .AddScoped <ITwoFactorManager, TwoFactorManager>(); return(husky); }
public static HuskyServiceHub AddAliyunOssBucket(this HuskyServiceHub husky, Action <AliyunOssBucketOptions> setupAction) { var options = new AliyunOssBucketOptions(); setupAction(options); husky.Services.AddSingleton <ICloudFileBucket>(new AliyunOssBucket(options)); return(husky); }
public static HuskyServiceHub AddQQLbs(this HuskyServiceHub husky, Action <QQLbsOptions> setupAction) { var options = new QQLbsOptions(); setupAction(options); husky.Services.AddSingleton <ILbs>(new QQLbsService(options)); return(husky); }
public static HuskyServiceHub AddAlipay(this HuskyServiceHub husky, Action <AlipayOptions> setupAction) { var options = new AlipayOptions(); setupAction(options); husky.Services.AddSingleton(new AlipayService(options)); return(husky); }
public static HuskyServiceHub AddWeChatIntegration(this HuskyServiceHub husky, WeChatOptions options) { husky.Services.AddScoped(svc => new WeChatService( options, svc.GetRequiredService <IHttpContextAccessor>(), svc.GetRequiredService <IMemoryCache>() ) ); return(husky); }
public static HuskyServiceHub AddIdentityManager(this HuskyServiceHub husky, IdentityOptions?options = null) { husky.Services.AddScoped <IIdentityManager>(svc => { var http = svc.GetRequiredService <IHttpContextAccessor>().HttpContext; if (http == null) { throw new InvalidProgramException($"IHttpContextAccessor.HttpContext is null here."); } return((options?.Carrier) switch { IdentityCarrier.Header => new HeaderIdentityManager(http, options), IdentityCarrier.Session => new SessionIdentityManager(http, options), _ => new CookieIdentityManager(http, options), }); });
public static HuskyServiceHub AddQQLbs(this HuskyServiceHub husky, QQLbsOptions options) { husky.Services.AddSingleton <ILbs>(new QQLbsService(options)); return(husky); }
public static HuskyServiceHub AddQQLbs(this HuskyServiceHub husky, string key) { husky.Services.AddSingleton <ILbs>(new QQLbsService(key)); return(husky); }
public static HuskyServiceHub AddKeyValueManager(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services.AddDbContextPool <IKeyValueDbContext, KeyValueDbContext>(optionsAction); husky.Services.AddSingleton <IKeyValueManager, KeyValueManager>(); return(husky); }
public static HuskyServiceHub AddFileStoreLogger(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services.AddDbContextPool <IFileStoreDbContext, FileStoreDbContext>(optionsAction); husky.Services.AddScoped <IFileStoreLogger, FileStoreLogger>(); return(husky); }
public static HuskyServiceHub AddAliyunOssBucket(this HuskyServiceHub husky, AliyunOssBucketOptions options) { husky.Services.AddSingleton <ICloudFileBucket>(new AliyunOssBucket(options)); return(husky); }
public static HuskyServiceHub AddLocalFileBucket(this HuskyServiceHub husky, string fileBucketRootPath) { husky.Services.AddSingleton <IFileBucket>(new LocalFileBucket(fileBucketRootPath)); return(husky); }
public static HuskyServiceHub AddAlipay(this HuskyServiceHub husky, AlipayOptions options) { husky.Services.AddSingleton(new AlipayService(options)); return(husky); }
public static HuskyServiceHub AddAliyunSms(this HuskyServiceHub husky, AliyunSmsOptions options) { husky.Services.AddSingleton <ISmsSender>(new AliyunSmsSender(options)); return(husky); }
public static HuskyServiceHub AddDiagnostics(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services.AddDbContextPool <IDiagnosticsDbContext, DiagnosticsDbContext>(optionsAction); husky.Services.AddScoped <IDiagnosticsLogger, DiagnosticsLogger>(); return(husky); }
public static HuskyServiceHub AddMailSender(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services.AddDbContextPool <IMailDbContext, MailDbContext>(optionsAction); husky.Services.AddScoped <IMailSender, MailSender>(); return(husky); }
public static HuskyServiceHub AddPrincipalAdmin(this HuskyServiceHub husky, Action <DbContextOptionsBuilder> optionsAction) { husky.Services.AddDbContextPool <IAdminsDbContext, AdminsDbContext>(optionsAction); husky.Services.AddScoped <IPrincipalAdmin, PrincipalAdmin>(); return(husky); }