private static UserManagementOptions GetOptions(IDictionary <string, string> options) { var result = new UserManagementOptions(); if (options != null) { bool canUpdateTwoFactorAuthentication; if (options.TryGetValue("CanUpdateTwoFactorAuthentication", out canUpdateTwoFactorAuthentication)) { result.CanUpdateTwoFactorAuthentication = canUpdateTwoFactorAuthentication; } } return(result); }
public static IServiceCollection AddUserManagement(this IServiceCollection services, IMvcBuilder mvcBuilder, UserManagementOptions userManagementOptions) { if (services == null) { throw new ArgumentNullException(nameof(services)); } if (mvcBuilder == null) { throw new ArgumentNullException(nameof(mvcBuilder)); } if (userManagementOptions == null) { throw new ArgumentNullException(nameof(userManagementOptions)); } var assembly = typeof(HomeController).Assembly; var embeddedFileProvider = new EmbeddedFileProvider(assembly); services.Configure <RazorViewEngineOptions>(options => { options.FileProviders.Add(embeddedFileProvider); }); services.AddSingleton(userManagementOptions); services.AddSingleton <IUiModule>(new UiManagerModuleUI()); mvcBuilder.AddApplicationPart(assembly); return(services); }