Skip to content

How to save a child collection #91

@kbaley

Description

@kbaley

I have a domain entity, Customer, with a collection of PhoneNumber entities. When I add a new customer, its data is saved but the phone numbers are not. I've tried making the phone number a value object and a full entity with the same result. The only way it works is if I explicitly loop over the phone numbers and call .Insert on its corresponding repository which I'd rather not do because I don't really want it to have its own repository. These are essentially value objects.

I notice in the code that .Insert is just changing the state of the customer entity which is probably what the phone numbers aren't saved. Which leads me to believe I have a misunderstanding of what I'm supposed to do in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions