mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Synchronous code
This commit is contained in:
parent
822749f17b
commit
ee1799769a
@ -31,6 +31,7 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
public virtual bool IsNoSql { get; set; }
|
||||
internal bool IsOpenAsync { get; set; }
|
||||
protected List<IDataParameter> OutputParameters { get; set; }
|
||||
public virtual string SqlParameterKeyWord { get { return "@"; } }
|
||||
|
@ -282,6 +282,13 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
types = sbTypes.ToString();
|
||||
if (this.QueryBuilder?.Context?.Ado is AdoProvider adoProvider)
|
||||
{
|
||||
if (adoProvider.IsNoSql)
|
||||
{
|
||||
types = "NoSql";
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
@ -300,6 +300,21 @@ namespace SqlSugar
|
||||
validPropertyName = validPropertyName == "byte[]" ? "byteArray" : validPropertyName;
|
||||
CSharpDataType validPropertyType = (CSharpDataType)Enum.Parse(typeof(CSharpDataType), validPropertyName);
|
||||
|
||||
#region NoSql
|
||||
if (this.Context.Ado is AdoProvider provider)
|
||||
{
|
||||
if (provider.IsNoSql)
|
||||
{
|
||||
method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType);
|
||||
if (method.IsVirtual)
|
||||
generator.Emit(OpCodes.Callvirt, method);
|
||||
else
|
||||
generator.Emit(OpCodes.Call, method);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Sqlite Logic
|
||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.Sqlite)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@ using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@ -30,6 +31,10 @@ namespace SqlSugar
|
||||
public QueryMethodInfo AS(string tableName)
|
||||
{
|
||||
string shortName = $"{tableName}_1";
|
||||
if (!Regex.IsMatch(shortName, @"^\w+$"))
|
||||
{
|
||||
shortName = "maintable";
|
||||
}
|
||||
var method = QueryableObj.GetType().GetMyMethod("AS", 2, typeof(string), typeof(string));
|
||||
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName });
|
||||
return this;
|
||||
|
@ -156,6 +156,14 @@ namespace SqlSugar
|
||||
string parameterName = this.Context.SqlParameterKeyWord + ExpressionConst.Const + this.Context.ParameterIndex;
|
||||
parameter.Context.Result.Append(base.Context.GetEqString(memberName, parameterName));
|
||||
var addItem = new SugarParameter(parameterName, parameter.CommonTempData);
|
||||
if (addItem.Value == null&&item.Type?.Name== "Nullable`1")
|
||||
{
|
||||
var genericType = item.Type?.GenericTypeArguments?.FirstOrDefault();
|
||||
if (genericType != null)
|
||||
{
|
||||
addItem.DbType = new SugarParameter(parameterName, UtilMethods.GetDefaultValue(genericType)).DbType;
|
||||
}
|
||||
}
|
||||
ConvertParameterTypeByType(item, addItem);
|
||||
|
||||
this.Context.Parameters.Add(addItem);
|
||||
|
Loading…
Reference in New Issue
Block a user