-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
69 lines (55 loc) · 1.91 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using Microsoft.AspNet.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using DasJott.Interfaces.Services;
using DasJott.Services;
using DasJott.Database;
using Microsoft.AspNet.Mvc.Razor;
namespace DasJott
{
public class Startup
{
private ModularViewLocator _modularViewLocations = new ModularViewLocator();
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddLogging();
services.AddScoped<IBundleService, BundleService>();
services.Configure<RazorViewEngineOptions>(opts =>
{
opts.ViewLocationExpanders.Add(_modularViewLocations);
});
services.AddEntityFramework()
.AddSqlite()
.AddDbContext<DjContext>();
/*
// Adds a pre-existing instance that will be referenced
IServiceCollection AddInstance<TService>(TService implementationInstance);
// Creates an instance once per request scope
IServiceCollection AddScoped<TService, TImplementation>();
// Creates a single instance that will be used each time the service is requested
IServiceCollection AddSingleton<TService>();
// Creates a new instance each time the service is requested
IServiceCollection AddTransient<TService>();
*/
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.MinimumLevel = LogLevel.Debug;
loggerFactory.AddConsole(LogLevel.Verbose);
_modularViewLocations.Logger = loggerFactory.CreateLogger("ModularViewLocator");
app.UseIISPlatformHandler();
app.UseDeveloperExceptionPage();
//app.UseMvcWithDefaultRoute();
app.UseMvc(route =>
{
route.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Start", action = "Index", id = "" }
);
});
app.UseStaticFiles();
}
}
}