Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save a child collection #91

Open
kbaley opened this issue Jun 30, 2022 · 0 comments
Open

How to save a child collection #91

kbaley opened this issue Jun 30, 2022 · 0 comments

Comments

@kbaley
Copy link

kbaley commented Jun 30, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant