48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using GWMS.Data.DatabaseModels;
|
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace GWMS.Data
|
|
{
|
|
public class UserIdentityDbContext : IdentityDbContext
|
|
{
|
|
#region Public Constructors
|
|
|
|
public UserIdentityDbContext()
|
|
{
|
|
}
|
|
|
|
public UserIdentityDbContext(DbContextOptions<UserIdentityDbContext> options)
|
|
: base(options)
|
|
{
|
|
// se non ci fosse... crea!
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public DbSet<TableCount> DbSetCounts { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
string connString = DbConfig.CONNECTION_STRING;
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
var serverVersion = ServerVersion.AutoDetect(connString);
|
|
optionsBuilder.UseMySql(connString, serverVersion);
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |