read write support

This commit is contained in:
xuejiaming 2021-09-07 13:18:58 +08:00
parent 773f11266f
commit 3e90bc1672
2 changed files with 8 additions and 8 deletions

View File

@ -1,8 +1,8 @@
:start :start
::定义版本 ::定义版本
set EFCORE2=2.2.0.19 set EFCORE2=2.2.0.20-pre1
set EFCORE3=3.2.0.19 set EFCORE3=3.2.0.20-pre1
set EFCORE5=5.2.0.19 set EFCORE5=5.2.0.20-pre1
::删除所有bin与obj下的文件 ::删除所有bin与obj下的文件
@echo off @echo off

View File

@ -41,11 +41,11 @@ namespace Sample.SqlServer
(conStr,builder) => builder.UseSqlServer(conStr).UseLoggerFactory(efLogger).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) (conStr,builder) => builder.UseSqlServer(conStr).UseLoggerFactory(efLogger).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
//.ReplaceService<IQueryTranslationPostprocessorFactory,SqlServer2008QueryTranslationPostprocessorFactory>()//支持sqlserver2008r2 //.ReplaceService<IQueryTranslationPostprocessorFactory,SqlServer2008QueryTranslationPostprocessorFactory>()//支持sqlserver2008r2
);//使用链接字符串创建dbcontext );//使用链接字符串创建dbcontext
op.UseReadWriteConfiguration(sp => new List<string>() //op.UseReadWriteConfiguration(sp => new List<string>()
{ //{
"Data Source=localhost;Initial Catalog=ShardingCoreDB1;Integrated Security=True;", // "Data Source=localhost;Initial Catalog=ShardingCoreDB1;Integrated Security=True;",
"Data Source=localhost;Initial Catalog=ShardingCoreDB2;Integrated Security=True;" // "Data Source=localhost;Initial Catalog=ShardingCoreDB2;Integrated Security=True;"
}, ReadStrategyEnum.Random); //}, ReadStrategyEnum.Random);
op.AddShardingTableRoute<SysUserModVirtualTableRoute>(); op.AddShardingTableRoute<SysUserModVirtualTableRoute>();
op.AddShardingTableRoute<SysUserSalaryVirtualTableRoute>(); op.AddShardingTableRoute<SysUserSalaryVirtualTableRoute>();
}); });