/// <summary> /// This method gets called by the runtime. Use this method to add services to the container. /// </summary> /// <param name="services">Specifies the contract for a collection of service descriptors.</param> public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "Banking Microservice", Version = "v1", Contact = new OpenApiContact { Name = "Georgios Manoltzas", Email = "*****@*****.**" }, Description = "A fully-featured banking microservice." }); var xmlFile = $"{Assembly.GetEntryAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); if (File.Exists(xmlPath)) { options.IncludeXmlComments(xmlPath); } }); services.AddMediatR(typeof(Startup)); services.AddDbContext <BankingDbContext>(options => { options.UseSqlServer(Configuration.GetConnectionString("BankingDbConnection")); }); DependencyContainer.ConfigureServices(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <Application.Core.Options.ApiOptions>( Configuration.GetSection("ApiOptions")); services.AddCors(); // Make sure you call this previous to AddMvc services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "GrafanaAPI", Version = "v1" }); }); services.AddHttpClient(); // Register dependencies services = DependencyContainer.ConfigureServices(services); }