【发布时间】:2010-12-10 20:49:27
【问题描述】:
我正在使用我的 linq 查询,如下所示
var result = from m in genDB.Membership_Association
join ag in genDB.Account_Group on m.Account_Group_ID equals ag.Account_Group_ID
join s in genDB.Account_Section on m.Account_Section_ID equals s.Account_Section_ID
join p in genDB.Account_Package on m.Account_Package_ID equals p.Account_Package_ID
join pinfo in genDB.ProductInfo on m.Product_ID equals pinfo.Product_Id
where m.Control_Plan_ID == controlPlanId && m.Account_ID == accId
select new MembershipViewModel
{
GroupNumber = ag.Account_Group_Number,
SectionNumber = s.Account_Section_Number,
PackageNumber = p.Account_Package_Number,
ProductName = pinfo.Product_Name,
CreatedDate = m.Create_Date.Date,
EffectiveDate = m.Effective_Date.Value.Date,
CancelledDate = m.Cancel_Date.Value.Date,
Status = m.Status
};
在上面的查询中,它抛出异常“LINQ to Entities 不支持指定的类型成员 'Date'。仅支持初始化程序、实体成员和实体导航属性。” at .Date 属性
【问题讨论】:
-
是的。这是不允许的。 (有什么问题?)
-
谢谢大卫。有没有其他方法可以获取日期
-
我只需要获取指定日期时间字段的日期,我需要在 linq 查询中获取它
标签: c# entity-framework