Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (42 sloc) 1.59 KB
// Copyright © 2015 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using ExtCore.Data.EntityFramework;
using ExtCore.WebApplication.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace WebApplication
{
public class Startup
{
private IConfiguration configuration;
private string extensionsPath;
public Startup(IHostingEnvironment hostingEnvironment, IConfiguration configuration, ILoggerFactory loggerFactory)
{
this.configuration = configuration;
this.extensionsPath = hostingEnvironment.ContentRootPath + this.configuration["Extensions:Path"];
loggerFactory.AddConsole();
loggerFactory.AddDebug();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddExtCore(this.extensionsPath, this.configuration["Extensions:IncludingSubpaths"] == true.ToString());
services.Configure<StorageContextOptions>(options =>
{
options.ConnectionString = this.configuration.GetConnectionString("Default");
}
);
}
public void Configure(IApplicationBuilder applicationBuilder, IHostingEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
{
applicationBuilder.UseDeveloperExceptionPage();
applicationBuilder.UseDatabaseErrorPage();
}
applicationBuilder.UseExtCore();
}
}
}