29 lines
1018 B
C#
29 lines
1018 B
C#
namespace LaaProduction.Personalization
|
|
{
|
|
using LaaProduction.Personalization.Repositories;
|
|
using LaaProduction.Personalization.Repositories.Interfaces;
|
|
|
|
using LaaProductionSQL;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using System;
|
|
|
|
internal static class ServiceProvider
|
|
{
|
|
private static IServiceProvider serviceProvider;
|
|
|
|
internal static T GetService<T>()
|
|
=> serviceProvider.GetService<T>();
|
|
|
|
internal static void RegisterInternalServices(string sqlConnectionString)
|
|
=> serviceProvider = new ServiceCollection()
|
|
.AddSingleton(_ => SQLConnection.CreateConnection(sqlConnectionString))
|
|
.AddScoped<IEmployeesRepository, EmployeesRepository>()
|
|
.AddScoped<IFunctionsRepository, FunctionsRepository>()
|
|
.AddScoped<IRolesRepository, RolesRepository>()
|
|
.AddScoped<ISoftwareRepository, SoftwareRepository>()
|
|
.BuildServiceProvider();
|
|
}
|
|
}
|