Sieve/SieveTests/Startup.cs

55 lines
1.7 KiB
C#
Raw Normal View History

2018-01-27 00:26:37 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
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;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
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
{
public class Startup
{
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>();
services.AddScoped<ISieveProcessor, SieveProcessor>();
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();
}
}
}