EDIT:
Although original question is DB agnostic.. following conversation in comments with OP. The question is slightly more DB specific.
Effectively given the fact that a Member has an Address开发者_如何学Go should the address be stored in the member table or in a table of its own.
Original question: Let's say we have a member entity and a weak entity called address. Is the best way of implementing to assign an ID to address and consider that ID to member entity of to have a field of member ID in address weak entity? I do not distinguish which is the best.
Secondly, Is this suppose to affect the way we design our BLLs? Since I am on DDD, I thought maybe that weak entity could be a good candidate for a value object in my members' root. Is that so?
I am not a DDD expert and I'm certainly not an expert of your problem domain. (you've not provided enough information for me to be clear of what your entities represent) but from what I understand you could have it either way.
If you are talking about postal addresses and a member representing a person on in your domain. You could have your address as a value object and just throw it away when you wanted to make changes to it. On the other hand you could build in more functionality to your address such as update, describe house, house value, calculate tax value etc.. the more complicated your object/entity becomes the more it seems to want to become an entity.
You need to have a conversation with your domain experts and find how they use addresses.
If you think that you will have to store multiple addresses for a member then you may consider an address table. However if the member will only have one address if may be enough to put it in its own table. It depends what other things you have in your member entity.
精彩评论