优化获取真实对象的方法

This commit is contained in:
xuejiaming 2022-10-31 23:23:32 +08:00
parent 9485ae03c1
commit 14ee07fe38
1 changed files with 7 additions and 4 deletions

View File

@ -66,10 +66,12 @@ namespace ShardingCore.Core.TrackerManagers
}
public Type TranslateEntityType(Type entityType)
{
if (_shardingConfigOptions.UseEntityFrameworkCoreProxies)
{
if (!_dbContextModels.ContainsKey(entityType))
{
if (_shardingConfigOptions.UseEntityFrameworkCoreProxies && entityType.BaseType != null)
if (entityType.BaseType != null)
{
if (_dbContextModels.ContainsKey(entityType.BaseType))
{
@ -77,6 +79,7 @@ namespace ShardingCore.Core.TrackerManagers
}
}
}
}
return entityType;
}