-
Notifications
You must be signed in to change notification settings - Fork 0
/
IocContainerConfiguration.cs
63 lines (57 loc) · 2.3 KB
/
IocContainerConfiguration.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
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Pulse.Core.Authorization;
using Pulse.Core.Notifications;
using Pulse.Core.Players;
using Pulse.Core.PlayerSettings;
using Pulse.Games.SchottenTotten2.Game;
using Pulse.Games.SchottenTotten2.Schotten2;
using Pulse.Games.SchottenTotten2.Storage;
using Pulse.Matchmaker.Logs;
using Pulse.Matchmaker.Matcher;
using Pulse.Matchmaker.Matches;
using Pulse.Ranking.Decay;
using Pulse.Ranking.Leaderboard;
using Pulse.Ranking.Rating;
namespace Pulse.Backend {
/// <summary>
/// Inversion of Control Container Configuration
/// </summary>
public static class IocContainerConfiguration {
/// <summary>
/// Configures dependency injection for all services.
/// </summary>
/// <param name="services">The collection of services that will receive injections.</param>
/// <param name="configuration">Access to the Configuration object, if needed.</param>
/// <param name="env">Access to the Environment object, if needed.</param>
public static void ConfigureService(IServiceCollection services, IConfiguration configuration, IWebHostEnvironment env) {
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton<MatchmakerPoolSingleton>();
services.AddScoped<AuthService>();
services.AddScoped<NotificationService>();
services.AddScoped<EmailService>();
services.AddScoped<PlayerService>();
services.AddScoped<PlayerSettingService>();
services.AddScoped<MatchService>();
services.AddScoped<MatchmakerService>();
services.AddScoped<MatchmakerLogService>();
services.AddScoped<LeaderboardService>();
services.AddScoped<RatingService>();
services.AddScoped<DecayService>();
services.AddSingleton<Schotten2Singleton>();
services.AddScoped<Schotten2Service>();
services.AddScoped<Schotten2Storage>();
services.AddScoped<GameEngine>();
services.AddDbContext<DataContext>(options =>
options.UseSqlServer(
configuration.GetConnectionString("DefaultConnection"),
options => options.EnableRetryOnFailure()
)
);
}
}
}