仓储-build
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Debug;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Repositories.Configuration.Log;
|
||||
|
||||
namespace WMS.Web.Repositories.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// db上下文
|
||||
/// </summary>
|
||||
public class RepositoryDbContext : DbContext
|
||||
{
|
||||
[Obsolete]
|
||||
public readonly LoggerFactory LoggerFactory = new LoggerFactory(new[] { new DebugLoggerProvider() });
|
||||
public RepositoryDbContext(DbContextOptions<RepositoryDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
LoggerFactory.AddProvider(new EFCoreLoggerProvider());
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
optionsBuilder.UseLoggerFactory(LoggerFactory).EnableSensitiveDataLogging();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user