This commit is contained in:
sunkaixuan
2025-02-19 19:43:00 +08:00
parent b2b2cbb8ec
commit 44d97c4d4a
2 changed files with 6 additions and 6 deletions

View File

@@ -392,12 +392,12 @@ namespace SqlSugar
FieldValue = String.Join(",", ids), FieldValue = String.Join(",", ids),
CSharpTypeName = navPkColumn?.UnderType?.Name CSharpTypeName = navPkColumn?.UnderType?.Name
})); }));
if (NavigationGlobalInstanceRegistry.IsAny()) if (OneToOneGlobalInstanceRegistry.IsAny())
{ {
foreach (var item in list) foreach (var item in list)
{ {
var firstObj = navObjectNamePropety.GetValue(item); var firstObj = navObjectNamePropety.GetValue(item);
if (NavigationGlobalInstanceRegistry.IsNavigationInitializerCreated(firstObj)) if (OneToOneGlobalInstanceRegistry.IsNavigationInitializerCreated(firstObj))
{ {
navObjectNamePropety.SetValue(item,null); navObjectNamePropety.SetValue(item,null);
} }

View File

@@ -7,7 +7,7 @@ using System.Text;
namespace SqlSugar namespace SqlSugar
{ {
internal static class NavigationGlobalInstanceRegistry internal static class OneToOneGlobalInstanceRegistry
{ {
private static readonly Dictionary<Type, object> _instances = new Dictionary<Type, object>(); private static readonly Dictionary<Type, object> _instances = new Dictionary<Type, object>();
private static readonly object _lock = new object(); private static readonly object _lock = new object();
@@ -49,13 +49,13 @@ namespace SqlSugar
{ {
Type type = typeof(T); Type type = typeof(T);
if (!NavigationGlobalInstanceRegistry.Instances.ContainsKey(type)) if (!OneToOneGlobalInstanceRegistry.Instances.ContainsKey(type))
{ {
T instance = new T(); T instance = new T();
NavigationGlobalInstanceRegistry.RegisterInstance(type, instance); OneToOneGlobalInstanceRegistry.RegisterInstance(type, instance);
} }
return (T)NavigationGlobalInstanceRegistry.Instances[type]; return (T)OneToOneGlobalInstanceRegistry.Instances[type];
} }
} }
} }