开发者

Where to code the database management of some entities in oop environtment

开发者 https://www.devze.com 2023-03-26 00:37 出处:网络
Say i have some entity classes like: avatar category set well all of them have name and description so i inherit it from abstract class.

Say i have some entity classes like:

avatar category set

well all of them have name and description so i inherit it from abstract class.

what i really want is, these classes need to be retreiv开发者_Python百科ed from a database.

Where to code the querys?

a) In external class, like "dbmanager" where you do something like dbmanager->sync(object_to_be_updated), then this class detects the class instance of object_to_be_updated, switch and does datbase stuff returning the updated object.

OR

b) Having just a method on each avatar, category, set doing the properly stuff.

0

精彩评论

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