/// <inheritdoc /> public void Attach(IEndpointRouteBuilder routeBuilder, IInternalApiConfiguration apiConfig, IServiceProvider scopedProvider) { var endPointList = apiConfig.GetEndPointHandlers(); foreach (var methodHandlerPair in endPointList) { foreach (var methodHandler in methodHandlerPair.Value.Values) { routeBuilder.MapMethods(methodHandler.RouteInformation.RouteTemplate, new[] { methodHandler.HttpMethod }, methodHandler.HandleRequest); } } }
/// <inheritdoc /> public virtual void Attach(IApplicationBuilder builder, IInternalApiConfiguration apiConfig, IServiceProvider scopedProvider) { _unmappedEndPointHandler = scopedProvider.GetService <IUnmappedEndPointHandler>(); var endPoints = CreateEndPointDictionary(apiConfig, _unmappedEndPointHandler); var routeBuilder = scopedProvider.GetService <IInternalEndPointRouteBuilder>(); _endPointHandlers = routeBuilder.BuildRouteFunc(endPoints); builder.Use(requestDelegate => { _requestDelegate = requestDelegate; return(Execute); }); }
/// <inheritdoc /> public void Configure(IInternalApiConfiguration apiInformation, IReadOnlyList <IEndPointMethodHandler> endPointMethodHandlersList) { var documentationOptions = _configurationManager.GetConfiguration <DocumentationOptions>(); _enabled = documentationOptions.Enabled; if (_enabled) { _redirect = documentationOptions.RedirectRootToDocumentation; _jsonDataPath = documentationOptions.UIBasePath + documentationOptions.OpenApiJsonUrl; _pathBase = documentationOptions.UIBasePath; _openApiGenerationService.Configure(documentationOptions, endPointMethodHandlersList); //_swaggerAssetProvider.Configure(documentationOptions); } }
protected virtual IDictionary <string, IEndPointHandler> CreateEndPointDictionary( IInternalApiConfiguration apiConfig, IUnmappedEndPointHandler unmappedEndPointHandler) { var endPointMethodHandlersDictionary = apiConfig.GetEndPointHandlers(); var list = endPointMethodHandlersDictionary.SelectMany(pair => pair.Value.Values).ToList(); _unmappedEndPointHandler.Configure(apiConfig, list); var endPointHandlerDictionary = new Dictionary <string, IEndPointHandler>(); foreach (var kvp in endPointMethodHandlersDictionary) { var valuesList = kvp.Value.Values.ToList(); var anyParameters = valuesList.Any(h => h.RouteInformation.Tokens.Count > 0); endPointHandlerDictionary[kvp.Key] = new HttpMethodEndPointHandler(kvp.Key, anyParameters, valuesList, _unmappedEndPointHandler); } return(endPointHandlerDictionary); }
public HttpMethodConfiguration(IInternalApiConfiguration internalApiConfiguration) { _internalApiConfiguration = internalApiConfiguration; }
/// <inheritdoc /> public void Configure(IInternalApiConfiguration apiInformation, IReadOnlyList <IEndPointMethodHandler> endPointMethodHandlersList) { }