我有一个带有“new_StartDate”和“new_EndDate”属性的“new_Term”实体。我实际上想在单个查询表达式中编写此语句:
new_StartDate <= DateTime.UtcNow <= new_EndDate
我的第一个想法是使用 Between ConditionOperator,但 between 运算符仅适用于单个属性,即:
// Not valid because the first parameter expects a string attribute name, not a value
new ConditionExpression(DateTime.UtcNow.Date, ConditionOperator.Between, "new_startdate", "new_enddate")
除了明显的两个条件表达式之外,有没有办法在一个条件表达式中做到这一点?
new ConditionExpression("new_startdate", ConditionOperator.LessEqual, DateTime.UtcNow);
new ConditionExpression("new_enddate", ConditionOperator.GreaterEqual, DateTime.UtcNow);