41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using BlueWest.Data;
|
|
using BlueWest.WebApi.MySQL.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace BlueWest.WebApi.MySQL
|
|
{
|
|
|
|
public sealed class UserDbContext : DbContext
|
|
{
|
|
public DbSet<User> Users { get; set; }
|
|
|
|
|
|
public IConfiguration Configuration;
|
|
|
|
|
|
/// <summary>
|
|
/// Database for the context of database users
|
|
/// </summary>
|
|
/// <param name="options"></param>
|
|
public UserDbContext(DbContextOptions<UserDbContext> options) : base(options)
|
|
{
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
/*optionsBuilder.UseMySql(
|
|
Configuration.GetConnectionString("LocalMySQL"),
|
|
new MySqlServerVersion(new Version(8, 0, 11))
|
|
);*/
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.ConfigureCurrentDbModel();
|
|
}
|
|
}
|
|
}
|