【发布时间】:2014-05-01 22:27:49
【问题描述】:
我有以下 linq 查询:
public static int GetContributions(PERSON person, DateTime startDate, DateTime endDate)
{
using (var db = new TestEntities())
{
var creditsSum = (from u in db.PERSON_SOCIAL_INSURANCE_CONTRIBUTIONS
where u.StartDate >= startDate
where u.EndDate <= endDate
where (u.PersonId == person.Id)
select (int?)u.NumOfContributions).Sum() ?? 0;
return creditsSum;
}
}
我想创建一个类似的方法来返回不属于提供的开始日期和结束日期之间的贡献数。所以基本上它会返回所有不在 startDate 和 endDate 值之间的条目。
有什么帮助吗?
【问题讨论】:
-
你能解释一下
fall这个词吗?没有与给定区间或完全包含的交集? -
我的意思是没有给定区间的交集
标签: c# .net linq linq-to-sql linq-to-entities