33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
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 CompanyBaseConfDbContext : DbContext
|
|
{
|
|
public CompanyBaseConfDbContext(DbContextOptions<CompanyBaseConfDbContext> 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);
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
|
|
public DbSet<DepartmentCrmconf> DepartmentCrmconf { get; set; }
|
|
public DbSet<Employee> Employee { get; set; }
|
|
}
|
|
}
|