完成readme的对事务的使用和启动配置

This commit is contained in:
xuejiaming 2021-10-19 17:10:39 +08:00
parent 2783b7c7a8
commit 4b69cd6b76
1 changed files with 1 additions and 4 deletions

View File

@ -201,7 +201,6 @@ or
o.CreateShardingTableOnStart = true;//create sharding table
o.EnsureCreatedWithOutShardingTable = true;//create data source with out sharding table
})
.AddShardingTransaction((connection, builder) =>builder.UseSqlServer(connection))
.AddDefaultDataSource("ds0", "Data Source=localhost;Initial Catalog=ShardingCoreDB1;Integrated Security=True;")
.AddShardingTableRoute(o =>
{
@ -390,8 +389,6 @@ or
o.CreateShardingTableOnStart = true;
o.EnsureCreatedWithOutShardingTable = true;
})
.AddShardingTransaction((connection, builder) =>
builder.UseSqlServer(connection))
.AddDefaultDataSource("ds0","Data Source=localhost;Initial Catalog=ShardingCoreDBxx0;Integrated Security=True;")
.AddShardingDataSource(sp =>
{
@ -568,7 +565,7 @@ ctor inject IShardingRouteManager shardingRouteManager
```
2.手动开启事务 [请参考微软](https://docs.microsoft.com/zh-cn/ef/core/saving/transactions)
```c#
using (var tran = _defaultTableDbContext.BeginTransaction())
using (var tran = _defaultTableDbContext.DataBase.BeginTransaction())
{
........
_defaultTableDbContext.SaveChanges();