Sieve/SieveTests/Startup.cs

49 lines
1.5 KiB
C#
Raw Normal View History

2018-05-15 01:34:37 +02:00
using Microsoft.AspNetCore.Builder;
2018-01-27 00:26:37 +01:00
using Microsoft.AspNetCore.Hosting;
2018-01-27 06:20:57 +01:00
using Microsoft.EntityFrameworkCore;
2018-01-27 00:26:37 +01:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
2018-01-27 06:20:57 +01:00
using Sieve.Models;
using Sieve.Services;
using SieveTests.Entities;
2018-01-27 07:37:38 +01:00
using SieveTests.Services;
2018-01-27 00:26:37 +01:00
namespace SieveTests
{
2018-05-15 01:34:37 +02:00
public class Startup
2018-01-27 00:26:37 +01:00
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
2018-01-27 06:20:57 +01:00
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("TestSqlServer")));
2018-01-27 09:30:34 +01:00
services.Configure<SieveOptions>(Configuration.GetSection("Sieve"));
2018-01-27 06:20:57 +01:00
2018-02-07 05:43:09 +01:00
services.AddScoped<ISieveCustomSortMethods, SieveCustomSortMethods>();
services.AddScoped<ISieveCustomFilterMethods, SieveCustomFilterMethods>();
2018-02-10 06:37:04 +01:00
services.AddScoped<ISieveProcessor, ApplicationSieveProcessor>();
2018-01-27 00:26:37 +01:00
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
}
}
}