|
|
@ -11,19 +11,22 @@ internal static class Register |
|
|
|
{ |
|
|
|
{ |
|
|
|
public static void InjectDependencies(IServiceCollection services, SqlOption contextOptions) |
|
|
|
public static void InjectDependencies(IServiceCollection services, SqlOption contextOptions) |
|
|
|
{ |
|
|
|
{ |
|
|
|
services.AddScoped<CollaborateursServices>(); |
|
|
|
services.AddScoped<CollaborateursService>(); |
|
|
|
services.AddScoped<AgenceService>(); |
|
|
|
services.AddScoped<AgenceService>(); |
|
|
|
|
|
|
|
services.AddScoped<BusinessUnitService>(); |
|
|
|
|
|
|
|
|
|
|
|
if (contextOptions.LoadFake) |
|
|
|
if (contextOptions.LoadFake) |
|
|
|
{ |
|
|
|
{ |
|
|
|
services.AddSingleton<ICollaborateurRepository, FakeCollaborateurRepository>(); |
|
|
|
services.AddSingleton<ICollaborateurRepository, FakeCollaborateurRepository>(); |
|
|
|
services.AddSingleton<IAgenceRepository, FakeAgenceRepository>(); |
|
|
|
services.AddSingleton<IAgenceRepository, FakeAgenceRepository>(); |
|
|
|
|
|
|
|
services.AddSingleton<IBusinessUnitRepository, FakeBusinessUnitRepository>(); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
services.AddScoped<MainDbContext>(); |
|
|
|
services.AddScoped<MainDbContext>(); |
|
|
|
services.AddScoped<ICollaborateurRepository, CollaborateurSqlRepository>(); |
|
|
|
services.AddScoped<ICollaborateurRepository, CollaborateurSqlRepository>(); |
|
|
|
services.AddScoped<IAgenceRepository, AgenceSqlRepository>(); |
|
|
|
services.AddScoped<IAgenceRepository, AgenceSqlRepository>(); |
|
|
|
|
|
|
|
services.AddScoped<IBusinessUnitRepository, BusinessUnitSqlRepository>(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |