When you use ObjectContextyour objects probably were not POCO and derived from EntityObjectthat automatically provides traceability between Orders, and data associated with it ( Licenseand OrderDetails) so you do not need to explicitly add OrderDetailsand Licensein context.
, DbContext, EF License OrderDetails, :
contextentity.OrderDetails.Add(orderDetails);
contextentity.Licenses.Add(license);
, ( , OrderDetails - - ), EF :
public class Orders
{
public virtual ICollection<OrderDetails> OrderLines { get; set; }
public virtual ICollection<License> Licenses { get; set; }
}
:
order.OrderLines.Add(orderDetails);
order.Licenses.Add(license);
( ) Orders, , .