首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

entity framework超简单的有关问题

2012-03-15 
entity framework超简单的问题FB fb new FB()ListCompany f (from c in fb.Companiesselect new Co

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不就行了

热点排行