2022-05-10 21:21:30 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2022-10-19 12:35:38 +08:00
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
|
using ShardingCore.Core.RuntimeContexts;
|
2022-05-10 21:21:30 +08:00
|
|
|
|
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
|
|
|
|
using ShardingCore.Sharding;
|
|
|
|
|
using ShardingCore.Sharding.Abstractions;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* @Author: xjm
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Date: DATE
|
|
|
|
|
* @Email: 326308290@qq.com
|
|
|
|
|
*/
|
|
|
|
|
namespace Sample.AutoCreateIfPresent
|
|
|
|
|
{
|
|
|
|
|
public class DefaultDbContext:AbstractShardingDbContext,IShardingTableDbContext
|
|
|
|
|
{
|
2022-07-19 16:37:14 +08:00
|
|
|
|
|
2022-05-10 21:21:30 +08:00
|
|
|
|
public DefaultDbContext(DbContextOptions<DefaultDbContext> options) : base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
modelBuilder.ApplyConfiguration(new OrderByHourMap());
|
2022-05-17 17:20:03 +08:00
|
|
|
|
modelBuilder.ApplyConfiguration(new AreaDeviceMap());
|
2022-05-10 21:21:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IRouteTail RouteTail { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|