2024-04-18 07:12:10 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace SCHALE.Common.Database
|
|
|
|
|
{
|
|
|
|
|
public static class ServicesExtesions
|
|
|
|
|
{
|
2024-05-01 09:11:11 +00:00
|
|
|
|
public static void AddSQLServerProvider(this IServiceCollection services, string connectionString)
|
2024-04-18 07:12:10 +00:00
|
|
|
|
{
|
2024-05-01 09:11:11 +00:00
|
|
|
|
services.AddDbContext<SCHALEContext>(o =>
|
2024-04-18 07:12:10 +00:00
|
|
|
|
{
|
2024-05-01 09:11:11 +00:00
|
|
|
|
o.UseSqlServer(connectionString, b =>
|
|
|
|
|
{
|
|
|
|
|
b.EnableRetryOnFailure(5, TimeSpan.FromSeconds(10), null);
|
|
|
|
|
})
|
|
|
|
|
.UseLazyLoadingProxies();
|
2024-04-28 01:41:38 +00:00
|
|
|
|
}, ServiceLifetime.Singleton, ServiceLifetime.Singleton);
|
2024-04-26 15:50:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-18 07:12:10 +00:00
|
|
|
|
}
|