C# EF4 POCO多对一

C# EF4 POCO多对一,c#,.net,entity-framework-4,poco,C#,.net,Entity Framework 4,Poco,我试图让一个POCO对象包含两个表 我有两张桌子: 我会有一个POCO对象: 顾客 你知道吗?这是没有流畅代码的代码优先解决方案 public class Customer { public int CustomerId { get; set;} //navigation public List<CustomerProperty> CustomerProperties { get; set;} } public class CustomerProperty { pub

我试图让一个POCO对象包含两个表

我有两张桌子:

我会有一个POCO对象: 顾客


你知道吗?

这是没有流畅代码的代码优先解决方案

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; }
}

它将产生两个表CustomerProperty和Customers,您可以从Customer实例访问CustomerProperty。

@我从您的回答中学到了一些东西。如何从我的Customer insatnce中显示CustomerProperty的属性?我只能从CustomerProperty实例显示客户属性?
- CustomerId
- Name
- CustomerProperties
- ExtendedProperties
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; }
}