开发者

saving list of value objects in table

开发者 https://www.devze.com 2023-01-29 16:26 出处:网络
I have simila开发者_StackOverflow社区r scenario in Domain Driven Design Question on Services and Repositories and http://pastie.org/795679 which the azamsharp faces.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消