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

21 lines
696 B
C#
Raw Normal View History

2024-04-18 07:12:10 +00:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
2024-04-18 07:12:10 +00:00
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
2024-04-18 07:12:10 +00:00
namespace SCHALE.Common.Database
{
public static class ServicesExtesions
{
public static void AddMongoDBProvider(this IServiceCollection services, string connectionString)
{
services.AddDbContext<SCHALEContext>(opt =>
{
opt.UseMongoDB(connectionString, "SCHALE");
2024-04-28 01:41:38 +00:00
}, ServiceLifetime.Singleton, ServiceLifetime.Singleton);
}
}
2024-04-18 07:12:10 +00:00
}