public FreeSqlBuilderUIMiddleware(RequestDelegate next, BuilderUIOptions genOptions , IWebHostEnvironment hostingEnv, ILoggerFactory loggerFactory) { //_next = next; _genOptions = genOptions ?? new BuilderUIOptions(); _staticFileMiddleware = CreateStaticFileMiddleware(next, hostingEnv, loggerFactory, _genOptions); }
/// <summary> /// 静态资源中间件创建 /// </summary> /// <param name="next"></param> /// <param name="hostingEnv"></param> /// <param name="loggerFactory"></param> /// <param name="options"></param> /// <returns></returns> private StaticFileMiddleware CreateStaticFileMiddleware( RequestDelegate next, IWebHostEnvironment hostingEnv, ILoggerFactory loggerFactory, BuilderUIOptions options ) { var staticFileOptions = new StaticFileOptions { RequestPath = $"/{options.Path}", FileProvider = new EmbeddedFileProvider(typeof(BuilderUIOptions).GetTypeInfo().Assembly, EmbeddedFileNamespace), }; return(new StaticFileMiddleware(next, hostingEnv, Options.Create(staticFileOptions), loggerFactory)); }