Skip to content

Commit cee1251

Browse files
committed
无法处理find的时候就用默认的find进行查询
1 parent 6cf015a commit cee1251

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/ShardingCore/EFCores/ShardingInternalDbSet.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,11 @@ private DbContext GetDbContextByKeyValue(params object[] keyValues)
419419
var isShardingDataSource = entityMetadata.IsShardingDataSource();
420420
var shardingDataSourceFieldIsKey = entityMetadata.ShardingDataSourceFieldIsKey();
421421
if (isShardingDataSource && !shardingDataSourceFieldIsKey)
422-
{
423-
throw new ShardingCoreNotSupportException("multi data source entity find key should sharding value");
424-
}
422+
return null;
425423
var isShardingTable = entityMetadata.IsShardingTable();
426424
var shardingTableFieldIsKey = entityMetadata.ShardingTableFieldIsKey();
427425
if (isShardingTable && !shardingTableFieldIsKey)
428-
{
429-
throw new ShardingCoreNotSupportException("multi table entity find key should sharding value");
430-
}
426+
return null;
431427
var primaryKeyValue = keyValues[0];
432428
if (primaryKeyValue != null)
433429
{
@@ -439,7 +435,7 @@ private DbContext GetDbContextByKeyValue(params object[] keyValues)
439435
}
440436
}
441437

442-
throw new ShardingCoreNotSupportException("sharding entity multi key");
438+
return null;
443439
}
444440

445441
private string GetDataSourceName(object shardingKeyValue)

0 commit comments

Comments
 (0)