is one to one relationship bad strategy

后端 未结 2 1738
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 21:31

User always has one Wallet. One Wallet belongs always to one User.

Since I want to separate money wallet related properties I was create Wallet object and to be able

2条回答
  •  难免孤独
    2020-12-19 22:08

    No it's fine. It's not just about relationships but object orientation. Fundamentaly a Wallet is not an unseverable part of a Person.

    Looking beyond that, whilst the wallet might belong to a specific 'John' now, 'James' might be given it as a present. From the data perspective it's much better to just change the WalletId fields of John and James of which one may be null (although not in your case) if they don't have a wallet.

提交回复
热议问题