LINQ代码返回了一个匿名类型,如何返回一个强类型的“Customers”?
我返回一个匿名类型,因为我只想从实体中选择特定的字段。
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
};
谢谢