public SwaggerBootstrapUIMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, ILoggerFactory loggerFactory, SwaggerBootstrapUIOptions options) { _options = options ?? new SwaggerBootstrapUIOptions(); _staticFileMiddleware = CreateStaticFileMiddleware(next, hostingEnv, loggerFactory, options); }
//private string SerializeToJson(object obj) //{ // return JsonConvert.SerializeObject(obj, new JsonSerializerSettings // { // ContractResolver = new CamelCasePropertyNamesContractResolver(), // Converters = new[] { new StringEnumConverter(true) }, // NullValueHandling = NullValueHandling.Ignore, // Formatting = Formatting.None, // StringEscapeHandling = StringEscapeHandling.EscapeHtml // }); //} private StaticFileMiddleware CreateStaticFileMiddleware( RequestDelegate next, IHostingEnvironment hostingEnv, ILoggerFactory loggerFactory, SwaggerBootstrapUIOptions options) { var staticFileOptions = new StaticFileOptions { //RequestPath = string.IsNullOrEmpty(options.StaticFilePrefix) ? string.Empty : $"/{options.StaticFilePrefix}", FileProvider = new EmbeddedFileProvider(typeof(SwaggerBootstrapUIMiddleware).GetTypeInfo().Assembly, EmbeddedFileNamespace), }; return(new StaticFileMiddleware(next, hostingEnv, Options.Create(staticFileOptions), loggerFactory)); }