sharding/test/ShardingCore.Test/ShardingDefaultDbContext.cs

49 lines
1.9 KiB
C#
Raw Permalink Normal View History

2021-11-09 10:51:18 +08:00
using Microsoft.EntityFrameworkCore;
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
using ShardingCore.Sharding;
using ShardingCore.Sharding.Abstractions;
using ShardingCore.Test.Domain.Maps;
2021-11-09 10:51:18 +08:00
namespace ShardingCore.Test
2021-11-09 10:51:18 +08:00
{
/*
* @Author: xjm
* @Description:
* @Date: 2021/8/15 10:21:03
* @Ver: 1.0
* @Email: 326308290@qq.com
*/
public class ShardingDefaultDbContext:AbstractShardingDbContext, IShardingTableDbContext
{
public ShardingDefaultDbContext(DbContextOptions<ShardingDefaultDbContext> options) : base(options)
{
}
2022-10-31 23:33:26 +08:00
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//{
// base.OnConfiguring(optionsBuilder);
// optionsBuilder.UseLazyLoadingProxies();
//}
2021-11-09 10:51:18 +08:00
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new SysUserModMap());
modelBuilder.ApplyConfiguration(new SysUserSalaryMap());
2021-11-19 23:10:01 +08:00
modelBuilder.ApplyConfiguration(new OrderMap());
modelBuilder.ApplyConfiguration(new LogDayMap());
2021-11-25 14:00:01 +08:00
modelBuilder.ApplyConfiguration(new LogWeekDateTimeMap());
2021-11-26 23:11:09 +08:00
modelBuilder.ApplyConfiguration(new LogWeekTimeLongMap());
modelBuilder.ApplyConfiguration(new LogYearDateTimeMap());
modelBuilder.ApplyConfiguration(new LogNoShardingMap());
modelBuilder.ApplyConfiguration(new LogMonthLongMap());
2021-11-26 23:32:01 +08:00
modelBuilder.ApplyConfiguration(new LogYearLongMap());
2021-11-27 09:51:46 +08:00
modelBuilder.ApplyConfiguration(new SysUserModIntMap());
2021-11-27 21:27:30 +08:00
modelBuilder.ApplyConfiguration(new LogDayLongMap());
modelBuilder.ApplyConfiguration(new MultiShardingOrderMap());
2021-11-09 10:51:18 +08:00
}
public IRouteTail RouteTail { get; set; }
}
}