SCHALE.GameServer/SCHALE.Common/Database/ServicesExtesions.cs

21 lines
657 B
C#
Raw Normal View History

2024-04-18 07:12:10 +00:00
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace SCHALE.Common.Database
{
public static class ServicesExtesions
{
public static void AddSQLServerProvider(this IServiceCollection services, string connectionString)
2024-04-18 07:12:10 +00:00
{
services.AddDbContext<SCHALEContext>(o =>
2024-04-18 07:12:10 +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-18 07:12:10 +00:00
}