的LINQ代码返回一个匿名类型我怎么能返回一个强类型的“客户”的? 我正在返回一个匿名类型,因为我只想从实体中选择某些字段。EF4我如何转换匿名类型的强类型的LINQ
var customer = from c in _entities.Customers
join con
in _entities.Contracts on c.CustomerID equals con.customerID
where con.contractNo == number
select new
{
Surname = c.Surname,
Forename= c.Forename,
Address = c.Address,
Suburb = c.Suburb,
State = c.State,
Postcode = c.PostCode,
PhoneNo = c.PhoneNo
};
感谢
你确实应该尝试接受一些你的答案,还是让人西港岛线我不愿意在将来帮助你。 – eandersson
@富士谢谢你的信息。 –