nexusforever/Source/NexusForever.WorldServer/Design/AuthContextFactory.cs
Rawaho 6ebe337877 Implemented database migrations.
Moved from database first to code first.
Upgraded to EFCore 3.1.
Upgraded to .NET Core 3.1.
2020-02-29 15:44:17 +13:00

23 lines
849 B
C#

using Microsoft.EntityFrameworkCore.Design;
using NexusForever.Database.Auth;
using NexusForever.Database.Configuration;
using NexusForever.Shared.Configuration;
namespace NexusForever.WorldServer.Design
{
public class AuthContextFactory : IDesignTimeDbContextFactory<AuthContext>
{
public AuthContext CreateDbContext(string[] args)
{
ConfigurationManager<WorldServerConfiguration>.Instance.Initialise("WorldServer.json");
return new AuthContext(new DatabaseConfig
{
Auth = new DatabaseConnectionString
{
Provider = DatabaseProvider.MySql,
ConnectionString = ConfigurationManager<WorldServerConfiguration>.Instance.Config.Database.Auth.ConnectionString
}
});
}
}
}