修改readme文件

This commit is contained in:
xuejiaming 2022-09-14 20:45:46 +08:00
parent 7f1edb4dd8
commit 716508cbdf
2 changed files with 10 additions and 6 deletions

View File

@ -172,17 +172,20 @@ dbcontext `AbstractShardingDbContext`和`IShardingTableDbContext`如果你是普
op.AddShardingTableRoute<OrderVirtualTableRoute>();
}).UseConfig(op =>
{
op.UseShardingQuery((conn, builder) =>
op.UseShardingQuery((connStr, builder) =>
{
builder.UseSqlServer(conn);
//connStr is delegate input param
builder.UseSqlServer(connStr);
});
op.UseShardingTransaction((conn, builder) =>
op.UseShardingTransaction((connection, builder) =>
{
builder.UseSqlServer(conn);
//connection is delegate input param
builder.UseSqlServer(connection);
});
//use your data base connection string
op.AddDefaultDataSource(Guid.NewGuid().ToString("n"),
"Data Source=localhost;Initial Catalog=EFCoreShardingTableDB;Integrated Security=True;");
}).EnsureConfig();
}).AddShardingCore();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@ -129,7 +129,8 @@ sharding table(spilt table eg. order_202101,order_202102,order_202103......),u n
### Step 4:Create route that data(Order) query mapping table name
```csharp
Route constructor support dependency injection,that's life time scope is `Singleton`
//Route constructor support dependency injection,that's life time scope is `Singleton`
public class OrderVirtualTableRoute:AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<Order>
{
//private readonly IServiceProvider _serviceProvider;