public ApiInfoController(IApiInfoService apiInfoService) { _apiInfoService = apiInfoService; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IHateoasHelper hateoasHelper, IApiInfoService apiInfoService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } var appSettingsSection = Configuration.GetSection("AppSettings"); var appSettings = appSettingsSection.Get <AppSettings>(); app.AddCors(appSettings.CorsAllowedOrigins, appSettings.CorsAllowedMethods, appSettings.CorsAllowedHeaders); app.UseAuthentication(); app.UseUIOfSwagger(appSettings.SwaggerEndPointJsonUrl, appSettings.SwaggerEndPointTitle); app.UseMiddleware <RequestResponseLoggingMiddleware>(); app.UseMiddleware <ApiKeyMiddleware <User, ApiKey> >(); loggerFactory.AddLog4Net(); app.UseHttpsRedirection(); app.UseMvc(b => { b.Select().Expand().Filter().OrderBy().MaxTop(100).Count(); b.MapODataServiceRoute("odata", "odata", GetEdmModel()); }); app.UseApiVersioning(); // Inicializando los colaboradores para Hateoas según las APIs que hayamos configurado apiInfoService.GetAll().ToList().ForEach(installedApi => hateoasHelper.AddCollaborator(installedApi.ApiType, installedApi.BaseHref)); }
public ApiInfoController(ILogger <ApiInfoController> logger, IApiInfoService apiInfoService) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _apiInfoService = apiInfoService ?? throw new ArgumentNullException(nameof(apiInfoService)); }