/// <summary> /// configure attachment by getting 'AttachmentServiceConfigurationOptions' object /// </summary> /// <param name="services"></param> /// <param name="options"></param> /// <returns></returns> public static AttachmentServiceConfigurationOptions AddAttachment(this IServiceCollection services, Action <AttachmentServiceConfigurationOptions> options) { if (options == null) { throw new ArgumentNullException(); } var o = new AttachmentServiceConfigurationOptions(services); options.Invoke(o); return(new AttachmentServiceConfigurationOptions(services)); }
public static void UseSqlServerAttachmenBusiness(this AttachmentServiceConfigurationOptions _this, string connectionString) { _this.services.AddScoped <IAttachmentBusiness>((s) => SqlServerAttachmenBusiness.SqlServerAttachmenBusinessFactory(connectionString)); }
public static void UseAuthorizationHandler <T>(this AttachmentServiceConfigurationOptions _this) where T : class, IAttachmentAuthorization { _this.services.AddScoped <IAttachmentAuthorization, T>(); _this.services.Decorate <IAttachmentBusiness, AuthorizationAttachmnetBusinessDecorator>(); }
public static void UseCookieSessionProvider(this AttachmentServiceConfigurationOptions _this) { _this.services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); _this.services.AddSingleton <IAttachmentSessionProvider, CookieAttachmentTokenProvider>(); }