Update linq to sql

This commit is contained in:
sunkaixuan 2023-04-22 20:34:06 +08:00
parent 81b619cd7a
commit 682b2dc055
8 changed files with 38 additions and 0 deletions

View File

@ -33,5 +33,10 @@ namespace SqlSugar
public ConditionalType ConditionalType { get; set; }
[Newtonsoft.Json.JsonIgnoreAttribute]
public Func<string,object> FieldValueConvertFunc { get; set; }
public static List<IConditionalModel> Create(params IConditionalModel[] conditionalModel)
{
return conditionalModel.ToList();
}
}
}

View File

@ -22,5 +22,6 @@ namespace SqlSugar
public bool SqlServerCodeFirstNvarchar { get; set; }
public bool IsAutoUpdateQueryFilter { get; set; }
public bool IsAutoDeleteQueryFilter { get; set; }
public bool EnableModelFuncMappingColumn { get; set; }
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
@ -8,6 +9,11 @@ namespace SqlSugar
{
public string FuncName { get; set; }
public List<object> Parameters { get; set; }
public static ObjectFuncModel Create(string FuncName, params object[] Parameters)
{
return new ObjectFuncModel() { FuncName = FuncName, Parameters = Parameters?.ToList() };
}
}
public class ArrayFuncModel: IFuncModel
{

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
@ -7,5 +8,9 @@ namespace SqlSugar
public class GroupByModel
{
public string FieldName { get; set; }
public static List<GroupByModel> Create(params GroupByModel[] groupModels)
{
return groupModels.ToList();
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
@ -8,5 +9,9 @@ namespace SqlSugar
{
public string FieldName { get; set; }
public OrderByType OrderByType { get; set; }
public static List<OrderByModel> Create(params OrderByModel[] orderByModel)
{
return orderByModel.ToList();
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
@ -8,5 +9,10 @@ namespace SqlSugar
{
public object FiledName { get; set; }
public string AsName { get; set; }
public static List<SelectModel> Create(params SelectModel[] SelectModels)
{
return SelectModels.ToList();
}
}
}

View File

@ -26,6 +26,15 @@ namespace SqlSugar
var resSql = "";
var resPars = new List<SugarParameter>();
resSql = GetSql(parameters, dbMethods, methodName, methodInfo, pars, resPars);
if (name.EqualCase("MappingColumn"))
{
if (!(this.Context?. CurrentConnectionConfig?.MoreSettings?.EnableModelFuncMappingColumn == true))
{
Check.ExceptionEasy("Enable MappingColumn need in ConnectionConfig - > MoreSettings - > EnableModelFuncMappingColumn set to true", "MappingColumn考虑到风险情况需要开启才能使用请在 ConnectionConfig->MoreSettings->EnableModelFuncMappingColumn设置为true");
}
resSql= resSql.TrimEnd(Convert.ToChar( this.SqlTranslationRight))
.TrimStart(Convert.ToChar(this.SqlTranslationLeft));
}
return new KeyValuePair<string, SugarParameter[]>(resSql, resPars.ToArray());
}
#endregion

View File

@ -207,6 +207,7 @@ namespace SqlSugar
IsAutoToUpper=it.MoreSettings.IsAutoToUpper,
IsAutoDeleteQueryFilter=it.MoreSettings.IsAutoDeleteQueryFilter,
IsAutoUpdateQueryFilter = it.MoreSettings.IsAutoUpdateQueryFilter,
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn
},
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle