/// <summary> /// Add storage configuration /// </summary> /// <typeparam name="TContext"></typeparam> /// <param name="configuration"></param> /// <param name="options"></param> /// <returns></returns> public static IEntitySecurityServiceCollection AddEntityModuleSecurityStorage <TContext>( this IEntitySecurityServiceCollection configuration, Action <DbContextOptionsBuilder> options) where TContext : DbContext, IEntitySecurityDbContext { configuration.Services.AddDbContext <TContext>(options); configuration.Services.AddScopedContextFactory <IEntitySecurityDbContext, TContext>(); return(configuration); }
/// <summary> /// Register ui module /// </summary> /// <param name="services"></param> /// <returns></returns> public static IEntitySecurityServiceCollection AddEntitySecurityRazorUIModule(this IEntitySecurityServiceCollection services) { services.Services.ConfigureOptions(typeof(EntitySecurityRazorFileConfiguration)); MenuEvents.Menu.OnMenuSeed += (sender, args) => { GearApplication.BackgroundTaskQueue.PushBackgroundWorkItemInQueue(async x => { await x.InjectService <IMenuService>().AppendMenuItemsAsync(new EntitiesPermissionsMenuInitializer()); }); }; return(services); }