SqlSugar : Improve the NoSql extension

This commit is contained in:
sunkaixuan 2025-05-05 15:00:26 +08:00
parent 092e58f0b2
commit 577203d47a
2 changed files with 16 additions and 0 deletions

View File

@ -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 "@"; } }

View File

@ -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)
{