mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-27 06:35:49 +08:00
-
This commit is contained in:
@@ -91,28 +91,28 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
#region 9-12
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9>(ConnectionConfig currentConnectionConfig)
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(ConnectionConfig currentConnectionConfig)
|
||||
{
|
||||
string className = "Queryable";
|
||||
className = GetClassName(currentConnectionConfig.DbType.ToString(), className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8,T9, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8,T9>>(className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9>>(className);
|
||||
return result;
|
||||
}
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10>(ConnectionConfig currentConnectionConfig)
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(ConnectionConfig currentConnectionConfig)
|
||||
{
|
||||
string className = "Queryable";
|
||||
className = GetClassName(currentConnectionConfig.DbType.ToString(), className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9,T10, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9,T10>>(className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>>(className);
|
||||
return result;
|
||||
}
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11>(ConnectionConfig currentConnectionConfig)
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(ConnectionConfig currentConnectionConfig)
|
||||
{
|
||||
string className = "Queryable";
|
||||
className = GetClassName(currentConnectionConfig.DbType.ToString(), className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11>>(className);
|
||||
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> result = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>(className);
|
||||
return result;
|
||||
}
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(ConnectionConfig currentConnectionConfig)
|
||||
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(ConnectionConfig currentConnectionConfig)
|
||||
{
|
||||
string className = "Queryable";
|
||||
className = GetClassName(currentConnectionConfig.DbType.ToString(), className);
|
||||
@@ -183,7 +183,8 @@ namespace SqlSugar
|
||||
{
|
||||
return new OracleUpdateable<T>();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return new UpdateableProvider<T>();
|
||||
}
|
||||
}
|
||||
@@ -289,21 +290,21 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
#region 9-12
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8,T9, Restult>(string className)
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, Restult>(string className)
|
||||
{
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),typeof(T9));
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9));
|
||||
}
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9,T10, Restult>(string className)
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, Restult>(string className)
|
||||
{
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9),typeof(T10));
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10));
|
||||
}
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10,T11, Restult>(string className)
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, Restult>(string className)
|
||||
{
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10),typeof(T11));
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11));
|
||||
}
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,T12, Restult>(string className)
|
||||
private static Restult CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, Restult>(string className)
|
||||
{
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11),typeof(T12));
|
||||
return CreateInstance<Restult>(className, typeof(T), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11), typeof(T12));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -353,5 +354,16 @@ namespace SqlSugar
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Services
|
||||
public static ICacheManager<V> GetCacheInstance<V>()
|
||||
{
|
||||
return ReflectionInoCache<V>.GetInstance();
|
||||
}
|
||||
public static ISerializeManager<V> GetSerializeInstance<V>()
|
||||
{
|
||||
return SerializeManager<V>.GetInstance();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace SqlSugar
|
||||
public string SerializeObject(object value)
|
||||
{
|
||||
DependencyManagement.TryJsonNet();
|
||||
return JsonHelper.SerializeObject(value);
|
||||
return InstanceFactory.GetSerializeInstance<string>().SerializeObject(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace SqlSugar
|
||||
public T DeserializeObject<T>(string value)
|
||||
{
|
||||
DependencyManagement.TryJsonNet();
|
||||
return JsonHelper.DeserializeObject<T>(value);
|
||||
return InstanceFactory.GetSerializeInstance<T>().DeserializeObject(value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
13
Src/Asp.Net/SqlSugar/Interface/ISerializeManager.cs
Normal file
13
Src/Asp.Net/SqlSugar/Interface/ISerializeManager.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public interface ISerializeManager<T>
|
||||
{
|
||||
string SerializeObject(object value);
|
||||
T DeserializeObject(string value);
|
||||
}
|
||||
}
|
||||
@@ -93,10 +93,11 @@
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubResolve.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubTools.cs" />
|
||||
<Compile Include="Infrastructure\DependencyManagement.cs" />
|
||||
<Compile Include="Interface\ISerializeManager.cs" />
|
||||
<Compile Include="Realization\Oracle\Deleteable\OracleDeleteable.cs" />
|
||||
<Compile Include="Realization\Oracle\Insertable\OracleInsertable.cs" />
|
||||
<Compile Include="Realization\Oracle\Updateable\OracleUpdateable.cs" />
|
||||
<Compile Include="Utilities\JsonHelper.cs" />
|
||||
<Compile Include="Utilities\SerializeManager.cs" />
|
||||
<Compile Include="Utilities\ReflectionExtensions.cs" />
|
||||
<Compile Include="Realization\MySql\CodeFirst\MySqlCodeFirst.cs" />
|
||||
<Compile Include="Realization\MySql\DbFirst\MySqlDbFirst.cs" />
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
internal class JsonHelper
|
||||
{
|
||||
public static string SerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value);
|
||||
}
|
||||
|
||||
public static T DeserializeObject<T>(string value)
|
||||
{
|
||||
var jSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
return JsonConvert.DeserializeObject<T>(value, jSetting);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Src/Asp.Net/SqlSugar/Utilities/SerializeManager.cs
Normal file
33
Src/Asp.Net/SqlSugar/Utilities/SerializeManager.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SerializeManager<T>:ISerializeManager<T>
|
||||
{
|
||||
private static SerializeManager<T> _instance = null;
|
||||
private static readonly object _instanceLock = new object();
|
||||
public static SerializeManager<T> GetInstance() {
|
||||
if (_instance == null)
|
||||
lock (_instanceLock)
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new SerializeManager<T>();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
public string SerializeObject(object value)
|
||||
{
|
||||
return JsonConvert.SerializeObject(value);
|
||||
}
|
||||
|
||||
public T DeserializeObject(string value)
|
||||
{
|
||||
var jSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
return JsonConvert.DeserializeObject<T>(value, jSetting);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user