|
@@ -112,10 +112,7 @@ public static class DynamicGridUtils
|
|
|
|
|
|
public static IEnumerable<Type> GetManyToManyTypes(Type type)
|
|
|
{
|
|
|
- _allm2mtypes ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
- x => x.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IManyToMany<,>))
|
|
|
- );
|
|
|
+ _allm2mtypes ??= CoreUtils.Entities.Where(x => x.HasInterface(typeof(IManyToMany<,>))).ToArray();
|
|
|
return _allm2mtypes.Where(x => x.GetInterfaces().Any(
|
|
|
i => i.IsGenericType
|
|
|
&& i.GetGenericTypeDefinition() == typeof(IManyToMany<,>)
|
|
@@ -135,16 +132,11 @@ public static class DynamicGridUtils
|
|
|
{
|
|
|
if (ClientFactory.IsSupported(map))
|
|
|
{
|
|
|
- _allm2mpages ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
+ _allm2mpages ??= CoreUtils.Entities.Where(
|
|
|
x => x.IsClass
|
|
|
- && !x.IsAbstract
|
|
|
&& !x.IsGenericType
|
|
|
- && x.GetInterfaces().Any(
|
|
|
- i => i.IsGenericType
|
|
|
- && i.GetGenericTypeDefinition() == typeof(IDynamicManyToManyGrid<,>)
|
|
|
- )
|
|
|
- );
|
|
|
+ && x.HasInterface(typeof(IDynamicManyToManyGrid<,>)))
|
|
|
+ .ToArray();
|
|
|
|
|
|
var subtypes = _allm2mpages.Where(
|
|
|
x => x.GetInterfaces().Any(i =>
|
|
@@ -170,11 +162,9 @@ public static class DynamicGridUtils
|
|
|
|
|
|
public static IEnumerable<Type> GetOneToManyTypes(Type type)
|
|
|
{
|
|
|
- _allo2mtypes ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
- x => x.GetInterfaces().Any(i =>
|
|
|
- i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IOneToMany<>) && x.GetCustomAttribute<ObsoleteAttribute>() == null)
|
|
|
- );
|
|
|
+ _allo2mtypes ??= CoreUtils.Entities.Where(
|
|
|
+ x => x.HasInterface(typeof(IOneToMany<>)) && !x.HasAttribute<ObsoleteAttribute>())
|
|
|
+ .ToArray();
|
|
|
return _allo2mtypes
|
|
|
.Where(x => x.GetInterfaces().Any(i =>
|
|
|
i.IsGenericType
|
|
@@ -196,17 +186,12 @@ public static class DynamicGridUtils
|
|
|
if (ClientFactory.IsSupported(map))
|
|
|
{
|
|
|
|
|
|
- _allo2mpages ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
+ _allo2mpages ??= CoreUtils.Entities.Where(
|
|
|
x =>
|
|
|
x.IsClass
|
|
|
- && !x.IsAbstract
|
|
|
&& !x.IsGenericType
|
|
|
- && x.GetInterfaces().Any(i =>
|
|
|
- i.IsGenericType
|
|
|
- && i.GetGenericTypeDefinition() == typeof(IDynamicOneToManyGrid<,>)
|
|
|
- )
|
|
|
- );
|
|
|
+ && x.HasInterface(typeof(IDynamicOneToManyGrid<,>)))
|
|
|
+ .ToArray();
|
|
|
|
|
|
var subtypes = _allo2mpages.Where(x => x.GetInterfaces().Any(
|
|
|
i => i.IsGenericType
|
|
@@ -236,16 +221,11 @@ public static class DynamicGridUtils
|
|
|
{
|
|
|
if (!_customeditorpages.TryGetValue(type, out var pageTypes))
|
|
|
{
|
|
|
- _allcepages ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
+ _allcepages ??= CoreUtils.Entities.Where(
|
|
|
x => x.IsClass
|
|
|
- && !x.IsAbstract
|
|
|
&& !x.IsGenericType
|
|
|
- && x.GetInterfaces().Any(i =>
|
|
|
- i.IsGenericType
|
|
|
- && i.GetGenericTypeDefinition() == typeof(IDynamicCustomEditorPage<>)
|
|
|
- )
|
|
|
- );
|
|
|
+ && x.HasInterface(typeof(IDynamicCustomEditorPage<>)))
|
|
|
+ .ToArray();
|
|
|
|
|
|
pageTypes = _allcepages.Where(x => x.GetInterfaces().Any(i =>
|
|
|
i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IDynamicCustomEditorPage<>) &&
|
|
@@ -279,16 +259,11 @@ public static class DynamicGridUtils
|
|
|
var editor = property.GetCustomAttributes().FirstOrDefault(x => x is BaseEditor);
|
|
|
if (editor == null || !(editor is NullEditor))
|
|
|
{
|
|
|
- _alleltypes ??= CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
+ _alleltypes ??= CoreUtils.Entities.Where(
|
|
|
x => x.IsClass
|
|
|
- && !x.IsAbstract
|
|
|
&& !x.IsGenericType
|
|
|
- && x.GetInterfaces().Any(i =>
|
|
|
- i.IsGenericType
|
|
|
- && i.GetGenericTypeDefinition() == typeof(IDynamicEnclosedListGrid<,>)
|
|
|
- )
|
|
|
- );
|
|
|
+ && x.HasInterface(typeof(IDynamicEnclosedListGrid<,>)))
|
|
|
+ .ToArray();
|
|
|
|
|
|
var subtypes = _alleltypes.Where(
|
|
|
x => x.GetInterfaces().Any(
|
|
@@ -449,11 +424,9 @@ public static class DynamicGridUtils
|
|
|
{
|
|
|
if (!_dynamicGrids.TryGetValue(gridType, out var grids))
|
|
|
{
|
|
|
- grids = CoreUtils.TypeList(
|
|
|
- AppDomain.CurrentDomain.GetAssemblies(),
|
|
|
+ grids = CoreUtils.Entities.Where(
|
|
|
myType =>
|
|
|
myType.IsClass
|
|
|
- && !myType.IsAbstract
|
|
|
&& !myType.IsGenericType
|
|
|
&& myType.IsAssignableTo(typeof(IDynamicGrid))
|
|
|
&& !myType.IsAssignableTo(typeof(ISpecificGrid))
|