我有 2 张桌子:Customer
和Customer_Address
我有一个功能:
public IEnumerable<Customer_Address> ReadAddressForCustomer(int CustomerID)
{
ProjectServiceForCustomerDataContext DB = new ProjectServiceForCustomerDataContext();
var CA = (from C in DB.Customer_Addresses
join cust in DB.Customers
on C.CustomerID equals cust.ID
where C.CustomerID == CustomerID
select new
{
CustomerName=cust.Name,
CustomerAddress=C.Address,
CustomerTel=C.Telephone
}).ToList();
return CA;
}
但是 CA 不是 aIEnumerable(Customer_Address)
因为它有Customer
字段 ( cust.Name
)
我怎么解决这个问题 ?