Ok i'm banging my head against the wall with this ,-)
The Address, Customer, and CustomerType tables listed in my database, I want to display general summary information about the client, so I create a query to combine these two tables and get the specified result.
var customers = (from c in tblCustomer.All()
join address in tblAddress.All() on c.Address equals address.AddressId
join type in tblCustomerType.All() on c.CustomerType equals type.CustomerTypeId
select new CustomerSummaryView
{
CustomerName = c.CustomerName,
CustomerType = type.Description,
Postcode = address.Postcode
});
return View(customers);
CustomerSummaryView is a Simple POCO
public class CustomerSummaryView
{
public string Postcode { get; set; }
public string CustomerType { get; set; }
public string CustomerName { get; set; }
}
Now for some reason this does not work, I get a list of CustomerSummaryView results in IEnumerable, each record has a customer name and zip code, but the client type field is always null.
I recreated this problem several times with different database tables and projected classes.
Any ideas?
Jon hilton
source
share