LINQ to Entities无法识别方法'System.Data.Entity.DbSet`1

时间:2014-04-18 22:25:32

标签: c# linq

 var query = from cl in
                 (
                     from cl in _dataContext.Set<CLIENT>()
                     from cr in
                         _dataContext.Set<CLIENT_REL>()
                             .Where(m => m.CLIENT_CHILD_ID == cl.CLIENT_ID)
                             .DefaultIfEmpty()
                             .AsEnumerable()

                     select new {cl.CLIENT_ID, cl.CLIENT_NAME, cr.CLIENT_PARENT_ID, cl.CLIENT_CODE, cl.CLIENT_DESCR}
                     )
                 from pcl in
                     _dataContext.Set<CLIENT>().Where(p => p.CLIENT_ID == cl.CLIENT_PARENT_ID).DefaultIfEmpty()

                 select new ClientDetail
                 {
                     ClientId = cl.CLIENT_ID,
                     ClientName = cl.CLIENT_NAME,
                     ClientCode = cl.CLIENT_CODE,
                     ClientDescription = cl.CLIENT_DESCR,
                     ParentName = pcl.CLIENT_NAME
                 };

投掷以下System.NotSupportedException

  

LINQ to Entities无法识别方法&#39; System.Data.Entity.DbSet`1 [Ika.Security.Data.Model.CLIENT_REL] SetCLIENT_REL&#39;方法,并且此方法无法转换为商店表达式。

我做错了什么?

0 个答案:

没有答案