mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 18:34:55 +08:00
Update .net core project
This commit is contained in:
@@ -17,6 +17,11 @@ namespace SqlSugar
|
|||||||
express.IfTrue,
|
express.IfTrue,
|
||||||
express.IfFalse
|
express.IfFalse
|
||||||
};
|
};
|
||||||
|
if (IsBoolMember(express))
|
||||||
|
{
|
||||||
|
Expression trueValue = Expression.Constant(true);
|
||||||
|
args[0]= ExpressionBuilderHelper.CreateExpression(express.Test, trueValue, ExpressionType.And);
|
||||||
|
}
|
||||||
var isLeft = parameter.IsLeft;
|
var isLeft = parameter.IsLeft;
|
||||||
MethodCallExpressionModel model = new MethodCallExpressionModel();
|
MethodCallExpressionModel model = new MethodCallExpressionModel();
|
||||||
model.Args = new List<MethodCallExpressionArgs>();
|
model.Args = new List<MethodCallExpressionArgs>();
|
||||||
@@ -40,5 +45,10 @@ namespace SqlSugar
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsBoolMember(ConditionalExpression express)
|
||||||
|
{
|
||||||
|
return express.Test is MemberExpression && (express.Test as MemberExpression).Expression is ParameterExpression;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ namespace SqlSugar
|
|||||||
SqlSugarScopeProvider GetConnectionScope(dynamic configId);
|
SqlSugarScopeProvider GetConnectionScope(dynamic configId);
|
||||||
SqlSugarProvider GetConnectionWithAttr<T>();
|
SqlSugarProvider GetConnectionWithAttr<T>();
|
||||||
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
|
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
|
||||||
|
ISugarQueryable<T> QueryableWithAttr<T>();
|
||||||
|
IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new();
|
||||||
|
IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new();
|
||||||
|
IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new();
|
||||||
|
IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new();
|
||||||
|
IDeleteable<T> DeleteableWithAttr<T>(T deleteObjs) where T : class, new();
|
||||||
|
IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new();
|
||||||
bool IsAnyConnection(dynamic configId);
|
bool IsAnyConnection(dynamic configId);
|
||||||
|
|
||||||
void Close();
|
void Close();
|
||||||
|
|||||||
@@ -1243,5 +1243,36 @@ namespace SqlSugar
|
|||||||
this.CurrentConnectionConfig = Tenant.ConnectionConfig;
|
this.CurrentConnectionConfig = Tenant.ConnectionConfig;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Tenant Crud
|
||||||
|
public ISugarQueryable<T> QueryableWithAttr<T>()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Queryable<T>();
|
||||||
|
}
|
||||||
|
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Insertable(insertObj);
|
||||||
|
}
|
||||||
|
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Insertable(insertObjs);
|
||||||
|
}
|
||||||
|
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Updateable(updateObj);
|
||||||
|
}
|
||||||
|
public IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Updateable(updateObjs);
|
||||||
|
}
|
||||||
|
public IDeleteable<T> DeleteableWithAttr<T>(T deleteObject) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Deleteable(deleteObject);
|
||||||
|
}
|
||||||
|
public IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjects) where T : class, new()
|
||||||
|
{
|
||||||
|
return this.GetConnectionWithAttr<T>().Deleteable(deleteObjects);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -695,5 +695,33 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return ScopedContext.ThenMapperAsync(list, action);
|
return ScopedContext.ThenMapperAsync(list, action);
|
||||||
}
|
}
|
||||||
|
public ISugarQueryable<T> QueryableWithAttr<T>()
|
||||||
|
{
|
||||||
|
return ScopedContext.QueryableWithAttr<T>();
|
||||||
|
}
|
||||||
|
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.InsertableWithAttr<T>(insertObj);
|
||||||
|
}
|
||||||
|
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.InsertableWithAttr<T>(insertObjs);
|
||||||
|
}
|
||||||
|
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.UpdateableWithAttr<T>(updateObj);
|
||||||
|
}
|
||||||
|
public IUpdateable<T> UpdateableWithAttr<T>(List<T> updateObjs) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.UpdateableWithAttr<T>(updateObjs);
|
||||||
|
}
|
||||||
|
public IDeleteable<T> DeleteableWithAttr<T>(T deleteObj) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.DeleteableWithAttr<T>(deleteObj);
|
||||||
|
}
|
||||||
|
public IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new()
|
||||||
|
{
|
||||||
|
return ScopedContext.DeleteableWithAttr<T>(deleteObjs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,22 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class ExpressionBuilderHelper
|
public class ExpressionBuilderHelper
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create Expression
|
||||||
|
/// </summary>
|
||||||
|
public static Expression CreateExpression(Expression left, Expression value, ExpressionType type)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (type == ExpressionType.Equal)
|
||||||
|
{
|
||||||
|
return Expression.Equal(left, Expression.Convert(value, left.Type));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Not implemented, later used in writing
|
||||||
|
return Expression.Equal(left, Expression.Convert(value, left.Type));
|
||||||
|
}
|
||||||
|
}
|
||||||
public static Expression<Func<T, object>> CreateNewFields<T>(EntityInfo entity,List<string> propertyNames)
|
public static Expression<Func<T, object>> CreateNewFields<T>(EntityInfo entity,List<string> propertyNames)
|
||||||
{
|
{
|
||||||
Type sourceType = typeof(T);
|
Type sourceType = typeof(T);
|
||||||
|
|||||||
Reference in New Issue
Block a user