Begin script abstraction
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - DatabaseContext.cs
|
||||
@@ -10,13 +11,23 @@ namespace ReallifeGamemode.Database.Models
|
||||
{
|
||||
public partial class DatabaseContext : DbContext
|
||||
{
|
||||
private readonly ILoggerFactory loggerFactory;
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
||||
|
||||
public DatabaseContext() { }
|
||||
public DatabaseContext(ILoggerFactory loggerFactory = null) {
|
||||
this.loggerFactory = loggerFactory;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
|
||||
if(loggerFactory != null)
|
||||
{
|
||||
optionsBuilder.UseLoggerFactory(loggerFactory);
|
||||
}
|
||||
|
||||
optionsBuilder.UseMySql("Host=localhost;Port=3306;Database=gtav-devdb;Username=gtav-dev;Password=Test123");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user