sharding/samples/Sample.NoShardingMultiLevel/DefaultDbContext.cs

34 lines
990 B
C#
Raw Permalink Normal View History

using Microsoft.EntityFrameworkCore;
using Sample.NoShardingMultiLevel.Maps;
using ShardingCore.Sharding;
namespace Sample.NoShardingMultiLevel
{
public class DefaultDbContext:AbstractShardingDbContext
{
public DefaultDbContext(DbContextOptions<DefaultDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new BossMap());
modelBuilder.ApplyConfiguration(new CompanyMap());
modelBuilder.ApplyConfiguration(new DepartmentMap());
}
2021-12-31 21:35:33 +08:00
public override void Dispose()
{
Console.WriteLine("DefaultDbContext dispose");
base.Dispose();
}
public override ValueTask DisposeAsync()
{
Console.WriteLine("DefaultDbContext disposeasync");
return base.DisposeAsync();
}
}
}