URF.Core
URF.Core copied to clipboard
How to save a child collection
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.