LINQ to Entities不支持成员

时间:2011-11-28 09:43:14

标签: linq entity-framework linq-to-entities

对FerFment的每次调用都会给出异常: LINQ to Entities不支持指定的类型成员'FPMENT'。仅支持初始值设定项,实体成员和实体导航属性。 为什么?这是一个导航问题吗? - 因为我已经设置了所有的导航和控制

var startDate = targetDate.Date;
var endDate = startDate.AddDays(1);
FViewRepository rep = new FViewRepository();
var query = rep.GetAllFView()
    .Where(x => x.FData.FVER_ID == x.FData.User.FerFpment.UserId)
    .Where(x => x.FPMENT == x.FData.User.FerFpment.FPMENT)
    .Where(x => x.FData.User.FerFpment.Date >= startDate 
        && x.FData.User.FerFpment.Date <= endDate)
    .GroupBy(o => o.FData.User)
    .Select(o => new ReportItemDTO
    {
        ReportedFsCount = o.Count(),
        PFverName = o.Key.Name,
        FCount = o.Count(g => g.FData.FPMENT ==
            g.FData.User.FerFpment.FPMENT),
        FPMENT = o.Select(x => x.FPMENT).Distinct(),





  public class FFment : IDataEntity
    {
        public virtual long UserId { get; set; }
        public virtual DateTime Date { get; set; }
        public virtual string FPMENT{ get; set; }
        public virtual IList<FData> FData { get; set; }
        public virtual User User { get; set; }

0 个答案:

没有答案