To store OrderDetails into separate tables, should it call ToTable on OrderDetails entity instead of on Order entity?
On the document:
```c#
modelBuilder.Entity
{
od.OwnsOne(c => c.BillingAddress);
od.OwnsOne(c => c.ShippingAddress);
}).ToTable("OrderDetails");
Should it be:
```c#
modelBuilder.Entity<Order>().OwnsOne(p => p.OrderDetails, od =>
{
od.OwnsOne(c => c.BillingAddress);
od.OwnsOne(c => c.ShippingAddress);
od.ToTable("OrderDetails");
});
@davidliang2008 - Both of them are same. Once you call modelBuilder.Entity<Order>().OwnsOne(p => p.OrderDetails) anything afterwards is configuring the owned entity rather than original entity. That is how chaining works.
Oh ok coz I didn't try executing the code myself. Thanks for clarifying 馃憤
@smitpatel When the overload with nested lambda is used the returned builder is the original one, so it does make a difference in this case.
@davidliang2008 The second snippet is the right one for your scenario.
Oh so the example on the Microsoft doc is indeed wrong then.
Most helpful comment
@smitpatel When the overload with nested lambda is used the returned builder is the original one, so it does make a difference in this case.
@davidliang2008 The second snippet is the right one for your scenario.