日期:2014-05-20  浏览次数:20735 次

entity framework超简单的问题
FB fb = new FB();
  List<Company> f = (from c in fb.Companies
  select new Company  
  {
  CompanyID = c.CompanyID,
  CompanyName = c.CompanyName,
  EntityKey = c.EntityKey,
  ClassicPans = c.ClassicPans,
  HistoryPans = c.HistoryPans,
  Remark = c.Remark
  }).ToList();


为什么这会报错??

The entity or complex type 'FootballModel.Company' cannot be constructed in a LINQ to Entities query. 
 


------解决方案--------------------
为什么要 new Company 直接 select c不就行了