diff --git a/README.md b/README.md
index 6ee50125..de0b8b6d 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ Server为例
- [Tail]
尾巴、后缀虚拟表和物理表的后缀
- [TailPrefix]
- 尾巴、后缀虚拟表和物理表的后缀中间的字符
+ 尾巴前缀虚拟表和物理表的后缀中间的字符
- [物理表]
顾名思义就是数据库对应的实际表信息,表名(
tablename
@@ -86,6 +86,52 @@ Server为例
## 配置
+配置entity 推荐 fluent api 可以实现自动建表功能
+`IShardingEntity`数据库对象必须继承该接口
+`ShardingKey`分表字段需要使用该特性
+
+```c#
+
+ public class SysUserRange:IShardingEntity
+ {
+ ///
+ /// 分表分库range切分
+ ///
+ [ShardingKey(TailPrefix = "_",AutoCreateTableOnStart = true)]
+ public string Id { get; set; }
+ ///
+ /// 姓名
+ ///
+ public string Name { get; set; }
+ ///
+ /// 年龄
+ ///
+ public int Age { get; set; }
+ }
+
+ public class SysUserRangeMap:IEntityTypeConfiguration
+ {
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.HasKey(o => o.Id);
+ builder.Property(o => o.Id).IsRequired().HasMaxLength(128);
+ builder.Property(o => o.Name).HasMaxLength(128);
+ builder.ToTable(nameof(SysUserRange));
+ }
+ }
+
+ private readonly IVirtualDbContext _virtualDbContext;
+
+ public ctor(IVirtualDbContext virtualDbContext)
+ {
+ _virtualDbContext = virtualDbContext;
+ }
+
+ public async Task ToList_All()
+ {
+ var ranges=await _virtualDbContext.Set().ToShardingListAsync();
+ }
+```
创建virtual
route
实现 `AbstractShardingOperatorVirtualRoute`
@@ -137,49 +183,6 @@ route
var shardingBootstrapper = app.ApplicationServices.GetRequiredService();
shardingBootstrapper.Start();
```
-配置entity 推荐 fluent api 可以实现自动建表功能
-```c#
-
- public class SysUserRange:IShardingEntity
- {
- ///
- /// 分表分库range切分
- ///
- [ShardingKey(TailPrefix = "_",AutoCreateTableOnStart = true)]
- public string Id { get; set; }
- ///
- /// 姓名
- ///
- public string Name { get; set; }
- ///
- /// 年龄
- ///
- public int Age { get; set; }
- }
-
- public class SysUserRangeMap:IEntityTypeConfiguration
- {
- public void Configure(EntityTypeBuilder builder)
- {
- builder.HasKey(o => o.Id);
- builder.Property(o => o.Id).IsRequired().HasMaxLength(128);
- builder.Property(o => o.Name).HasMaxLength(128);
- builder.ToTable(nameof(SysUserRange));
- }
- }
-
- private readonly IVirtualDbContext _virtualDbContext;
-
- public ctor(IVirtualDbContext virtualDbContext)
- {
- _virtualDbContext = virtualDbContext;
- }
-
- public async Task ToList_All()
- {
- var ranges=await _virtualDbContext.Set().ToShardingListAsync();
- }
-```
## 使用
```c#