This commit is contained in:
parent
085e22bb88
commit
701043b41c
|
@ -322,7 +322,7 @@ AbstractSimpleShardingYearKeyLongVirtualTableRoute |按时间戳 |yyyy | `>,>=,<
|
||||||
{
|
{
|
||||||
op.EnsureCreatedWithOutShardingTable = true;
|
op.EnsureCreatedWithOutShardingTable = true;
|
||||||
op.CreateShardingTableOnStart = true;
|
op.CreateShardingTableOnStart = true;
|
||||||
op.UseShardingOptionsBuilder((connection, builder) => builder.UseSqlServer("write db connection string").UseLoggerFactory(efLogger),
|
op.UseShardingOptionsBuilder((connection, builder) => builder.UseSqlServer(connection).UseLoggerFactory(efLogger),
|
||||||
(conStr,builder)=> builder.UseSqlServer("read db connection string").UseLoggerFactory(efLogger));
|
(conStr,builder)=> builder.UseSqlServer("read db connection string").UseLoggerFactory(efLogger));
|
||||||
op.AddShardingTableRoute<SysUserModVirtualTableRoute>();
|
op.AddShardingTableRoute<SysUserModVirtualTableRoute>();
|
||||||
op.AddShardingTableRoute<SysUserSalaryVirtualTableRoute>();
|
op.AddShardingTableRoute<SysUserSalaryVirtualTableRoute>();
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace Sample.SqlServer.DbContexts
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
modelBuilder.ApplyConfiguration(new SysUserModMap());
|
modelBuilder.ApplyConfiguration(new SysUserModMap());
|
||||||
modelBuilder.ApplyConfiguration(new SysTestMap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRouteTail RouteTail { get; set; }
|
public IRouteTail RouteTail { get; set; }
|
||||||
|
|
|
@ -3,13 +3,16 @@ using ShardingCore.Core;
|
||||||
|
|
||||||
namespace Sample.SqlServer.Domain.Entities
|
namespace Sample.SqlServer.Domain.Entities
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* @Author: xjm
|
* @Author: xjm
|
||||||
* @Description:
|
* @Description:
|
||||||
* @Date: Tuesday, 26 January 2021 12:25:39
|
* @Date: Tuesday, 26 January 2021 12:25:39
|
||||||
* @Email: 326308290@qq.com
|
* @Email: 326308290@qq.com
|
||||||
*/
|
*/
|
||||||
public class SysUserMod:IShardingTable
|
/// <summary>
|
||||||
|
/// 用户表
|
||||||
|
/// </summary>
|
||||||
|
public class SysUserMod : IShardingTable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户Id用于分表
|
/// 用户Id用于分表
|
||||||
|
|
|
@ -30,8 +30,9 @@ namespace Sample.SqlServer
|
||||||
{
|
{
|
||||||
op.EnsureCreatedWithOutShardingTable = true;
|
op.EnsureCreatedWithOutShardingTable = true;
|
||||||
op.CreateShardingTableOnStart = true;
|
op.CreateShardingTableOnStart = true;
|
||||||
op.UseShardingOptionsBuilder((connection, builder) => builder.UseSqlServer(connection).UseLoggerFactory(efLogger),
|
op.UseShardingOptionsBuilder(
|
||||||
(conStr,builder) => builder.UseSqlServer(conStr).UseLoggerFactory(efLogger));
|
(connection, builder) => builder.UseSqlServer(connection).UseLoggerFactory(efLogger),//使用dbconnection创建dbcontext支持事务
|
||||||
|
(conStr,builder) => builder.UseSqlServer(conStr).UseLoggerFactory(efLogger));//使用链接字符串创建dbcontext
|
||||||
op.AddShardingTableRoute<SysUserModVirtualTableRoute>();
|
op.AddShardingTableRoute<SysUserModVirtualTableRoute>();
|
||||||
});
|
});
|
||||||
////不支持MARS不支持追踪的
|
////不支持MARS不支持追踪的
|
||||||
|
|
Loading…
Reference in New Issue