public static IAppBuilder UseMapDashboard <T>( this IAppBuilder app, string pathMatch = "/dashboard", T options = default(T), RouteCollection routes = null, IEnumerable <IDashboardAuthorizationFilter> authorization = null ) where T : class, new() { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (pathMatch == null) { throw new ArgumentNullException(nameof(pathMatch)); } #if NETSTANDARD var services = app.ApplicationServices; options = options ?? services.GetService <T>() ?? new T(); routes = routes ?? services.GetRequiredService <RouteCollection>(); authorization = authorization ?? services.GetServices <IDashboardAuthorizationFilter>(); app.Map(new PathString(pathMatch), x => x.UseMiddleware <AspNetCoreFileManagerMiddleware <T> >(options, authorization, routes)); #else if (routes == null) { throw new ArgumentNullException(nameof(routes)); } authorization = authorization ?? new IDashboardAuthorizationFilter[] { }; app.Map(new PathString(pathMatch), x => x.Use <AspNetCoreFileManagerMiddlewareOwin <T> >(options, authorization, routes)); #endif return(app); }