Exemple #1
0
        /// <summary>
        /// Make the UserAdminController available to MVC as Controller
        /// </summary>
        /// <typeparam name="TUser"></typeparam>
        /// <typeparam name="TContext"></typeparam>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static IMvcBuilder ConfigureUserAdmin <TUser, TContext>(this IMvcBuilder builder)
            where TContext : DbContext
            where TUser : IdentityUser <string>
        {
            var p = new UseradminControllerFeatureProvider <TUser, TContext>();

            GenericControllerNameConvention.RegisterController(p.Type);
            return(builder.ConfigureApplicationPartManager(apm => apm.FeatureProviders.Add(p)));
        }
Exemple #2
0
        /// <summary>
        /// adds the static files for useradmin, and prepare route, call before UseEndpoints
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseUseradmin(this IApplicationBuilder app, bool addfiles = true)
        {
            var options = app.ApplicationServices.GetRequiredService <IOptions <UserAdminLib.Configuration.UserAdminOptions> >();

            GenericControllerNameConvention.SetURL(null, options.Value.Url);

            if (addfiles)
            {
                app.UseStaticFiles(new StaticFileOptions
                {
                    FileProvider = new ZipFileSystem(new MemoryStream(UserAdminLib.Properties.Resources.www), "wwwroot"),// new ManifestEmbeddedFileProvider(typeof(UserAdminExtensions).Assembly, "wwwroot"),
                    RequestPath  = "/useradmin"
                });
            }
            return(app);
        }