mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 09:44:39 +08:00
Update InstanceFactory
This commit is contained in:
@@ -6,13 +6,14 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
|
|
||||||
public class InstanceFactory
|
public class InstanceFactory
|
||||||
{
|
{
|
||||||
static Assembly assembly = Assembly.GetExecutingAssembly();
|
static Assembly assembly = Assembly.GetExecutingAssembly();
|
||||||
static Dictionary<string, Type> typeCache = new Dictionary<string, Type>();
|
static Dictionary<string, Type> typeCache = new Dictionary<string, Type>();
|
||||||
private static string _CustomDllName = "";
|
private static string _CustomDllName = "";
|
||||||
private static List<string> CustomDlls = new List<string>();
|
private static List<string> CustomDlls = new List<string>();
|
||||||
|
public static Assembly[] CustomAssemblies = new Assembly[]{};
|
||||||
public static string CustomDllName {
|
public static string CustomDllName {
|
||||||
get { return _CustomDllName; }
|
get { return _CustomDllName; }
|
||||||
set
|
set
|
||||||
@@ -637,6 +638,10 @@ namespace SqlSugar
|
|||||||
var newAssembly = new ReflectionInoCacheService().GetOrCreate<Assembly>(key, () => {
|
var newAssembly = new ReflectionInoCacheService().GetOrCreate<Assembly>(key, () => {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (CustomAssemblies?.Any(it => it.FullName.StartsWith(customDllName))==true)
|
||||||
|
{
|
||||||
|
return CustomAssemblies?.First(it => it.FullName.StartsWith(customDllName));
|
||||||
|
}
|
||||||
var path = Assembly.GetExecutingAssembly().Location;
|
var path = Assembly.GetExecutingAssembly().Location;
|
||||||
if (path.HasValue())
|
if (path.HasValue())
|
||||||
{
|
{
|
||||||
@@ -692,6 +697,10 @@ namespace SqlSugar
|
|||||||
var newAssembly = new ReflectionInoCacheService().GetOrCreate<Assembly>(key, () => {
|
var newAssembly = new ReflectionInoCacheService().GetOrCreate<Assembly>(key, () => {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (CustomAssemblies?.Any(it => it.FullName.StartsWith(customDllName)) == true)
|
||||||
|
{
|
||||||
|
return CustomAssemblies?.First(it => it.FullName.StartsWith(customDllName));
|
||||||
|
}
|
||||||
var path = Assembly.GetExecutingAssembly().Location;
|
var path = Assembly.GetExecutingAssembly().Location;
|
||||||
if (path.HasValue())
|
if (path.HasValue())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user