mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
-
This commit is contained in:
@@ -39,11 +39,25 @@ namespace OrmTest.UnitTest
|
|||||||
DateIsSameByType();
|
DateIsSameByType();
|
||||||
DateAddDay();
|
DateAddDay();
|
||||||
DateAddByType();
|
DateAddByType();
|
||||||
|
DateValue();
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
base.End("Method Test");
|
base.End("Method Test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DateValue()
|
||||||
|
{
|
||||||
|
var x2 = DateTime.Now;
|
||||||
|
Expression<Func<Student, bool>> exp = it => NBORM.DateValue(x2,DateType.Year);
|
||||||
|
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
|
||||||
|
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||||
|
var value = expContext.Result.GetString();
|
||||||
|
var pars = expContext.Parameters;
|
||||||
|
base.Check(value, pars, " (@MethodConst1(@MethodConst0)) ", new List<SugarParameter>() {
|
||||||
|
new SugarParameter("@MethodConst0",x2),new SugarParameter("@MethodConst1",DateType.Year)
|
||||||
|
}, "StartsWith");
|
||||||
|
}
|
||||||
|
|
||||||
private void StartsWith()
|
private void StartsWith()
|
||||||
{
|
{
|
||||||
Expression<Func<Student, bool>> exp = it => NBORM.StartsWith(it.Name, "a");
|
Expression<Func<Student, bool>> exp = it => NBORM.StartsWith(it.Name, "a");
|
||||||
|
|||||||
@@ -96,5 +96,12 @@ namespace SqlSugar
|
|||||||
var parameter2 = model.Args[1];
|
var parameter2 = model.Args[1];
|
||||||
return string.Format(" ({0} like '%'+{1}) ", parameter.Value, parameter2.Value);
|
return string.Format(" ({0} like '%'+{1}) ", parameter.Value, parameter2.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object DateValue(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameter = model.Args[0];
|
||||||
|
var parameter2 = model.Args[1];
|
||||||
|
return string.Format(" ({0}({1})) ", parameter2.Value, parameter.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace SqlSugar
|
|||||||
object DateIsSameDay(MethodCallExpressionModel model);
|
object DateIsSameDay(MethodCallExpressionModel model);
|
||||||
object DateIsSameByType(MethodCallExpressionModel model);
|
object DateIsSameByType(MethodCallExpressionModel model);
|
||||||
object DateAddByType(MethodCallExpressionModel model);
|
object DateAddByType(MethodCallExpressionModel model);
|
||||||
|
object DateValue(MethodCallExpressionModel model);
|
||||||
object DateAddDay(MethodCallExpressionModel model);
|
object DateAddDay(MethodCallExpressionModel model);
|
||||||
object Between(MethodCallExpressionModel model);
|
object Between(MethodCallExpressionModel model);
|
||||||
object StartsWith(MethodCallExpressionModel model);
|
object StartsWith(MethodCallExpressionModel model);
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ namespace SqlSugar
|
|||||||
public static string ToUpper(object thisValue) { throw new NotImplementedException(); }
|
public static string ToUpper(object thisValue) { throw new NotImplementedException(); }
|
||||||
public static string Trim(object thisValue) { throw new NotImplementedException(); }
|
public static string Trim(object thisValue) { throw new NotImplementedException(); }
|
||||||
public static bool Contains(string thisValue, string parameterValue) { throw new NotImplementedException();}
|
public static bool Contains(string thisValue, string parameterValue) { throw new NotImplementedException();}
|
||||||
|
public static bool StartsWith(string thisValue, string parameterValue) { throw new NotImplementedException(); }
|
||||||
|
public static bool EndsWith(string thisValue, string parameterValue) { throw new NotImplementedException(); }
|
||||||
public new static bool Equals(object thisValue, object parameterValue) { throw new NotImplementedException(); }
|
public new static bool Equals(object thisValue, object parameterValue) { throw new NotImplementedException(); }
|
||||||
public static bool DateIsSame(DateTime date1, DateTime date2) { throw new NotImplementedException();}
|
public static bool DateIsSame(DateTime date1, DateTime date2) { throw new NotImplementedException();}
|
||||||
public static bool DateIsSame(DateTime date1, DateTime date2, DateType dataType) { throw new NotImplementedException(); }
|
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 date, int addValue, DateType millisecond){ throw new NotImplementedException(); }
|
||||||
public static bool DateAdd(DateTime date1, int addValue) { throw new NotImplementedException(); }
|
public static bool DateAdd(DateTime date, int addValue) { throw new NotImplementedException(); }
|
||||||
|
public static bool DateValue(DateTime date, DateType dataType) { throw new NotImplementedException(); }
|
||||||
public static bool Between(object value, object start, object end){ throw new NotImplementedException();}
|
public static bool Between(object value, object start, object end){ throw new NotImplementedException();}
|
||||||
public static bool StartsWith(string thisValue, string parameterValue) { throw new NotImplementedException();}
|
|
||||||
public static bool EndsWith(string thisValue, string parameterValue) {throw new NotImplementedException();}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ namespace SqlSugar
|
|||||||
return this.Context.DbMehtods.DateAddDay(model);
|
return this.Context.DbMehtods.DateAddDay(model);
|
||||||
else
|
else
|
||||||
return this.Context.DbMehtods.DateAddByType(model);
|
return this.Context.DbMehtods.DateAddByType(model);
|
||||||
|
case "DateValue":
|
||||||
|
return this.Context.DbMehtods.DateValue(model);
|
||||||
case "Between":
|
case "Between":
|
||||||
return this.Context.DbMehtods.Between(model);
|
return this.Context.DbMehtods.Between(model);
|
||||||
case "StartsWith":
|
case "StartsWith":
|
||||||
|
|||||||
Reference in New Issue
Block a user