I'm trying to have开发者_高级运维 one POCO objects containing 2 tables.
I have 2 tables :
-Customer (#CustomerId, Name, CustomerProperties)
-CustomerExtended (#ExtendedId, #CustomerId, extendedProperties)
And I would have one POCO object:
Customer
- CustomerId
- Name
- CustomerProperties
- ExtendedProperties
Have you any idea?
This is code-first solution (without fluent code).
public class Customer
{
public int CustomerId { get; set;}
//navigation
public List<CustomerProperty> CustomerProperties { get; set;}
}
public class CustomerProperty
{
public int CustomerPropertyId { get; set;}
//navigation
public Customer Customer { get; set; }
}
It will pruduce two tables CustomerProperties and Customers, and you can access CustomerProperties from the Customer instance.
精彩评论