44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using DG.EntityFramework;
|
|
using Hg.Core.Entity;
|
|
using Hg.Core.Entity.Views.DNZZ;
|
|
using Hg.Core.Entity.Views.HGBM;
|
|
using Hg.Core.Entity.Views.PTD2;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Diagnostics;
|
|
using Microsoft.Extensions.Logging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hg.Core.EntityFramework
|
|
{
|
|
public class UserCenterDbContext : DbContext
|
|
{
|
|
public UserCenterDbContext(DbContextOptions<UserCenterDbContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
|
|
{
|
|
var loggerFactory = new LoggerFactory();
|
|
loggerFactory.AddProvider(new EFLoggerProvider());
|
|
optionsBuilder.UseLoggerFactory(loggerFactory);
|
|
}
|
|
optionsBuilder.ConfigureWarnings(b => b.Ignore(CoreEventId.ContextInitialized));
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
|
|
public DbSet<UserInfo> UserInfo { get; set; }
|
|
}
|
|
}
|