saving list of value objects in table
I have simila开发者_StackOverflow社区r scenario in Domain Driven Design Question on Services and Repositories and http://pastie.org/795679 which the azamsharp faces.
Since registration is value object, and user can have list of value objects, how can i save this registrations in user table because there is 1 to M relationship between User and Registration. Do i have to create seperate table for registration.
DDD or no DDD, it you have a 1-M relationship, the cleanest solution is a separate Registration
table, with an FK back to the User
.
Just because Registrations
are Value objects, doesn't mean that you have to save them in the User
table. It's a common misconception with DDD newbies. Maybe this answer can help.
精彩评论