OData实体关系

OData实体关系,odata,Odata,刚接触OData,遇到了一个我需要帮助的问题。有两个实体,客户和订单。客户有一个复杂的财产电话,这一切都是伟大的工作。但是,当我添加一个带有有效customer对象的订单时,它会以customer的空值插入DB中 想知道我遗漏了什么,任何指点都将不胜感激。谢谢 课程基本上是: public class Customer { public int Id {get;set;} public Phone Phone1 {get;set;} ... } public class Pho

刚接触OData,遇到了一个我需要帮助的问题。有两个实体,客户和订单。客户有一个复杂的财产电话,这一切都是伟大的工作。但是,当我添加一个带有有效customer对象的订单时,它会以customer的空值插入DB中

想知道我遗漏了什么,任何指点都将不胜感激。谢谢

课程基本上是:

public class Customer
{
   public int Id {get;set;}
   public Phone Phone1 {get;set;}
   ...
}
public class Phone
{
   public int Id {get;set;}
   public string Number {get;set;}
   ...
}
public class Order
{
   public int Id {get;set;}
   public Customer Customer {get;set;}
   ...
}

In my WebApiConfig
            builder.EntitySet<Customer>("Customers");
            builder.EntitySet<Order>("Orders");
            builder.ComplexType<Phone>();

The metadata for order looks like this:
<EntityType Name="Order">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false"/>
<Property Name="Updated" Type="Edm.DateTimeOffset" Nullable="false"/>
...
<NavigationProperty Name="Customer" Type="Project.Common.Models.Customer"/>
</EntityType>

当客户端设置正确的customer对象时,在controller中,customer的order对象中的值为null。我还注意到,在DB中填充的phone对象是正确的,但返回到客户端时,值为null。所以我错过了一些重要的东西。谢谢