diff --git a/README-zh.md b/README-zh.md
index 7d0897d9..6fe42e7d 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -437,16 +437,13 @@ or
## 分表
我们以用户取模来做例子,配置entity 推荐 [fluent api](https://docs.microsoft.com/en-us/ef/core/modeling/)
-`IShardingTable`数据库对象必须继承该接口
-`ShardingTableKey`分表字段需要使用该特性
```c#
- public class SysUserMod : IShardingTable
+ public class SysUserMod
{
///
/// 用户Id用于分表
///
- [ShardingTableKey]
public string Id { get; set; }
///
/// 用户名称
@@ -473,6 +470,10 @@ or
public SysUserModVirtualTableRoute() : base(2,3)
{
}
+ public override void Configure(EntityMetadataTableBuilder builder)
+ {
+ builder.ShardingProperty(o => o.Id);
+ }
}
```
@@ -594,12 +595,11 @@ or
`ShardingDataSourceKey`分库字段需要使用该特性
```c#
- public class SysUserMod : IShardingDataSource
+ public class SysUserMod
{
///
/// 用户Id用于分库
///
- [ShardingDataSourceKey]
public string Id { get; set; }
///
/// 用户名称
@@ -647,6 +647,11 @@ or
};
}
+ public override void Configure(EntityMetadataDataSourceBuilder builder)
+ {
+ builder.ShardingProperty(o => o.Name);
+ }
+
public override bool AddDataSourceName(string dataSourceName)
{
throw new NotImplementedException();
diff --git a/README.md b/README.md
index a63ad890..2613e413 100644
--- a/README.md
+++ b/README.md
@@ -450,16 +450,13 @@ or
## 分表
我们以用户取模来做例子,配置entity 推荐 [fluent api](https://docs.microsoft.com/en-us/ef/core/modeling/)
-`IShardingTable`数据库对象必须继承该接口
-`ShardingTableKey`分表字段需要使用该特性
```c#
- public class SysUserMod : IShardingTable
+ public class SysUserMod
{
///
/// 用户Id用于分表
///
- [ShardingTableKey]
public string Id { get; set; }
///
/// 用户名称
@@ -486,6 +483,10 @@ or
public SysUserModVirtualTableRoute() : base(2,3)
{
}
+ public override void Configure(EntityMetadataTableBuilder builder)
+ {
+ builder.ShardingProperty(o => o.Id);
+ }
}
```
@@ -607,12 +608,11 @@ or
`ShardingDataSourceKey`分库字段需要使用该特性
```c#
- public class SysUserMod : IShardingDataSource
+ public class SysUserMod
{
///
/// 用户Id用于分库
///
- [ShardingDataSourceKey]
public string Id { get; set; }
///
/// 用户名称
@@ -665,6 +665,11 @@ or
throw new NotImplementedException();
}
+ public override void Configure(EntityMetadataDataSourceBuilder builder)
+ {
+ builder.ShardingProperty(o => o.Name);
+ }
+
protected override Expression> GetRouteToFilter(string shardingKey, ShardingOperatorEnum shardingOperator)
{