-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathStartup.cs
More file actions
37 lines (31 loc) · 1.28 KB
/
Copy pathStartup.cs
File metadata and controls
37 lines (31 loc) · 1.28 KB
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
using DiscordBotTutorial.Core.Services.Items;
using DiscordBotTutorial.Core.Services.Profiles;
using DiscordBotTutorial.DAL;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace DiscordBotTutorial.Bots
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<RPGContext>(options =>
{
options.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=RPGContext;Trusted_Connection=True;MultipleActiveResultSets=true",
x => x.MigrationsAssembly("DiscordBotTutorial.DAL.Migrations"));
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
});
services.AddScoped<IItemService, ItemService>();
services.AddScoped<IExperienceService, ExperienceService>();
services.AddScoped<IProfileService, ProfileService>();
var serviceProvider = services.BuildServiceProvider();
var bot = new Bot(serviceProvider);
services.AddSingleton(bot);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
}