仓储-build

This commit is contained in:
tongfei
2023-10-18 10:56:19 +08:00
parent 05ee79a04f
commit b477662e67
10 changed files with 825 additions and 5 deletions

View File

@@ -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);
}
}
}