/// <summary> /// Creates a new instance of <see cref="ApiDescriptionGroupCollectionProvider"/>. /// </summary> /// <param name="apiDescriptionGroupCollectionProvider"> /// The <see cref="IApiDescriptionGroupCollectionProvider"/>. /// </param> public ApiDescriptionGroupModelCollectionProvider( IOptions <OrchidOptions> serverOptions, IApiDescriptionGroupCollectionProvider apiDescriptionGroupCollectionProvider, IDocumentationProvider documentationProvider, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <ApiDescriptionGroupModelCollectionProvider>(); _serverOptions = serverOptions.Value; if (_serverOptions.ObsoleteRoutePathPattern != null) { try { _obsoleteRouteRegex = new Regex(_serverOptions.ObsoleteRoutePathPattern, RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); } catch (Exception ex) { _logger.LogError($"Invalid obsolete route pattern: {ex.Message}"); #if DEBUG throw; #endif } } _apiDescriptionGroupCollectionProvider = apiDescriptionGroupCollectionProvider; _documentationProvider = documentationProvider; }
private void EnsureServices(HttpContext context) { if (_serverOptions == null) { _serverOptions = context.RequestServices.GetService <IOptions <OrchidOptions> >().Value; } if (_hostingEnvironment == null) { _hostingEnvironment = context.RequestServices.GetService <IHostingEnvironment>(); } }