mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
-
This commit is contained in:
@@ -44,7 +44,14 @@ namespace OrmTest.UnitTest
|
||||
|
||||
private void Between()
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
Expression<Func<Student, bool>> exp = it => NBORM.Between(it.Name,1, 2);
|
||||
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
|
||||
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, " ([Name] BETWEEN @MethodConst0 AND @MethodConst1) ", new List<SugarParameter>() {
|
||||
new SugarParameter("@MethodConst0",1),new SugarParameter("@MethodConst1",2),
|
||||
}, "Between");
|
||||
}
|
||||
|
||||
private void DateAddByType()
|
||||
|
||||
@@ -74,5 +74,13 @@ namespace SqlSugar
|
||||
var parameter2 = model.Args[1];
|
||||
return string.Format(" (DATEADD(day,{1},{0})) ", parameter.Value, parameter2.Value);
|
||||
}
|
||||
|
||||
public object Between(MethodCallExpressionModel model)
|
||||
{
|
||||
var parameter = model.Args[0];
|
||||
var parameter1 = model.Args[1];
|
||||
var parameter2 = model.Args[2];
|
||||
return string.Format(" ({0} BETWEEN {1} AND {2}) ", parameter.Value, parameter1.Value, parameter2.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,6 @@ namespace SqlSugar
|
||||
object DateIsSameByType(MethodCallExpressionModel model);
|
||||
object DateAddByType(MethodCallExpressionModel model);
|
||||
object DateAddDay(MethodCallExpressionModel model);
|
||||
object Between(MethodCallExpressionModel model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ namespace SqlSugar
|
||||
public static bool DateIsSame(DateTime date1, DateTime date2, DateType dataType) { throw new NotImplementedException(); }
|
||||
public static bool DateAdd(DateTime date1, int addValue, DateType millisecond){ throw new NotImplementedException(); }
|
||||
public static bool DateAdd(DateTime date1, int addValue) { throw new NotImplementedException(); }
|
||||
public static bool Between(object value, object start, object end){ throw new NotImplementedException();}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ namespace SqlSugar
|
||||
return this.Context.DbMehtods.DateAddDay(model);
|
||||
else
|
||||
return this.Context.DbMehtods.DateAddByType(model);
|
||||
case "Between":
|
||||
return this.Context.DbMehtods.Between(model);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user