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.
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
.Inserton 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
.Insertis 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.