add support for Dynamic Entity Registration in DbContext by Provides IXEntityRegisterar interface and XBaseEntityRegisterar as an abstract Implementation ...

all other requirements handled inside Module.
This commit is contained in:
2026-05-26 22:06:38 +03:30
parent 3d274c347f
commit 1dbda46d4c
8 changed files with 474 additions and 8 deletions
+33
View File
@@ -63,5 +63,38 @@ namespace xDataService.Extensions {
return result;
}
/// <summary>
/// Check a Type is XBaseEntity or not ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsXEntity(this Type source)
{
//
var result = !source.IsNull();
if (!result)
{
return result;
}
//
var baseType = source.BaseType;
while(!baseType.IsNull() && baseType != typeof(object))
{
//
if (baseType.IsGenericType &&
baseType.GetGenericTypeDefinition() == typeof(XBaseEntity<>))
{
result = true;
break;
}
//
baseType = baseType.BaseType;
}
//
return result;
}
}
}