0

I have this:

Class Order
{
    long ID;
    ...
}

Class Item
{
    long Id;
    IdProduct;
    decimal Amount;
    ...
}

Perhaps I misunderstood what means bidirectional relation in DDD, because I have read that if it is possible, it is better to have only navigation from parent to child, and not from child to parent, but I don't know if navigation means not to have in the child a property of type order but I need a long property for the ID of the parent or not navigation from child to parent means to have a long property for the ID parent too.

Thanks.

3
  • I’m not sure I understand correctly but if you don’t want a navigation properly from the child to the parent, simply give the parent a collection of children.
    – Rik D
    Commented Oct 10, 2022 at 17:12
  • You may be thinking about relational databases, database records and foreign keys? There is no reason to do this with objects. Commented Oct 10, 2022 at 19:06
  • @RobertBräutigam Yes, I was thinking more from a database point of view, thinking how to map this case in EF Core, if the item has not a property with the ID of the order. But really from a point of view of DDD I don't need this. Commented Oct 11, 2022 at 14:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.