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:
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using GraphQL;
|
||||
using GraphQL.Server;
|
||||
using GraphQL.Server.Ui.Playground;
|
||||
@@ -1245,6 +1248,41 @@ namespace xDataService.Helpers
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Entity Assembly Detector ...
|
||||
/// <summary>
|
||||
/// Extract Assemblies which Contains Entity ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Assembly> ExtractEntityAssemblies()
|
||||
{
|
||||
//
|
||||
var result = new List<Assembly>();
|
||||
|
||||
//
|
||||
var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
foreach (var assembly in allAssemblies)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
bool hasEntity = assembly
|
||||
.GetExportedTypes()
|
||||
.Any(t => t.IsXEntity());
|
||||
if (hasEntity)
|
||||
{
|
||||
result.Add(assembly);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user