Beispiel #1
0
 /// <summary>
 /// 添加SMS服务。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>服务构建实例。</returns>
 public static IServiceBuilder AddSMS(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultSmsDataMigration>()
            .AddSingletons <ITaskService, DefaultSmsTaskService>()
            .AddSingleton <ISmsManager, SmsManager>()
            .AddSingleton <ISmsSettingManager, SmsSettingManager>());
 }
Beispiel #2
0
 /// <summary>
 /// 添加事件组件。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>返回服务构建实例。</returns>
 public static IServiceBuilder AddEvent(this IServiceBuilder builder)
 {
     builder.AddTransients <IDataMigration, DefaultEventDataMigration>();
     builder.AddSingleton <IEventManager, EventManager>();
     builder.AddSingleton <IEventLogger, EventLogger>();
     return(builder);
 }
Beispiel #3
0
 /// <summary>
 /// 添加邮件组件。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>服务构建实例。</returns>
 public static IServiceBuilder AddEmails(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultEmailDataMigration>()
            .AddSingleton <IEmailManager, EmailManager>()
            .AddSingleton <IEmailSettingsManager, EmailSettingsManager>()
            .AddSingletons <ITaskService, DefaultEmailTaskService>());
 }
Beispiel #4
0
 /// <summary>
 /// 添加开放平台组件。
 /// </summary>
 /// <typeparam name="TUser">用户类型。</typeparam>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>服务构建实例。</returns>
 public static IServiceBuilder AddOpenServices <TUser>(this IServiceBuilder builder)
     where TUser : class, IUser
 {
     return(builder.AddTransients <IDataMigration, ApplicationDataMigration>()
            .AddSingleton <IApplicationManager, ApplicationManager <TUser> >()
            .AddSingleton <IOpenServiceManager, OpenServiceManager>());
 }
Beispiel #5
0
 /// <summary>
 /// 添加Saas服务。
 /// </summary>
 /// <typeparam name="TSite">网站实例类型。</typeparam>
 /// <param name="builder">服务构建实例对象。</param>
 /// <returns>返回服务构建实例对象。</returns>
 public static IServiceBuilder AddSites <TSite>(this IServiceBuilder builder)
     where TSite : Site, new()
 {
     return(builder.AddTransients <IDataMigration, DefaultSiteDataMigration>()
            .AddSingleton(typeof(ISiteManager <>), typeof(SiteManager <>))
            .AddScoped(service => service.GetRequiredService <ISiteDomainManager>().Current)
            .AddScoped(service =>
     {
         var current = service.GetRequiredService <SiteDomain>();
         if (current == null)
         {
             return null;
         }
         var siteManager = service.GetRequiredService <ISiteManager <TSite> >();
         return siteManager.Find(current.SiteId);
     })
            .AddTransients <IInitializer, SiteInitializer <TSite> >());
 }
Beispiel #6
0
 /// <summary>
 /// 添加敏感词汇组件。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>服务构建实例。</returns>
 public static IServiceBuilder AddSensitiveWords(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultSensitiveWordDataMigration>()
            .AddSingleton <ISensitiveWordManager, SensitiveWordManager>());
 }
Beispiel #7
0
 /// <summary>
 /// 添加短信验证服务。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>服务构建实例。</returns>
 public static IServiceBuilder AddCaptchas(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultCaptchaDataMigration>()
            .AddSingleton <ICaptchaManager, CaptchaManager>()
            .AddSingletons <ITaskService, DefaultClearTaskService>());
 }
Beispiel #8
0
 /// <summary>
 /// 添加名称值组件。
 /// </summary>
 /// <param name="builder">服务构建实例对象。</param>
 /// <returns>返回服务构建实例对象。</returns>
 public static IServiceBuilder AddNamedString(this IServiceBuilder builder)
 {
     builder.AddTransients <IDataMigration, DefaultNamedStringDataMigration>()
     .AddSingleton <INamedStringManager, NamedStringManager>();
     return(builder);
 }
Beispiel #9
0
 /// <summary>
 /// 添加配置组件。
 /// </summary>
 /// <param name="builder">服务构建实例对象。</param>
 /// <returns>返回服务构建实例对象。</returns>
 public static IServiceBuilder AddSettings(this IServiceBuilder builder)
 {
     builder.AddTransients <IDataMigration, DefaultSettingsDataMigration>()
     .AddSingleton <ISettingsManager, SettingsManager>();
     return(builder);
 }
Beispiel #10
0
 /// <summary>
 /// 添加对象更改实例组件。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>返回服务构建实例。</returns>
 public static IServiceBuilder AddDiffer(this IServiceBuilder builder)
 {
     builder.AddTransients <IDataMigration, DefaultDifferDataMigration>();
     builder.AddSingleton <IDifferManager, DifferManager>();
     return(builder);
 }
Beispiel #11
0
 /// <summary>
 /// 添加后台任务组件。
 /// </summary>
 /// <param name="builder">服务构建实例对象。</param>
 /// <returns>返回服务构建实例对象。</returns>
 public static IServiceBuilder AddTaskServices(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultTaskDataMigration>()
            .AddSingleton <ITaskManager, TaskManager>()
            .AddSingletons <IHostedService, DefaultTaskHostedService>());
 }
Beispiel #12
0
 /// <summary>
 /// 添加用户通知组件。
 /// </summary>
 /// <param name="builder">服务构建实例。</param>
 /// <returns>返回服务构建实例。</returns>
 public static IServiceBuilder AddNotification(this IServiceBuilder builder)
 {
     return(builder.AddTransients <IDataMigration, DefaultNotificationDataMigration>()
            .AddTransients <INotificationManager, NotificationManager>());
 }