如果OR M框架为引用限制的建模提供了便利的话,这些内容会在你的数据库和应用程序代码上重复定义。
If your ORM framework offers facilities for modeling referential constraints, these are again defined both on your DB and in your application code.
一个价格表上的价格可以依赖于另一个价格表,这意味这你不用为每一个产品重复定义所有的情况。
The prices on a pricelist can depend on another list, which means that you do not have to repeat the definition of all conditions for each product.
与其重复定义和管理这些属性的代码,不如创建一个通用的帐户(account)类,该类具有现金收支平衡并且可以处理借贷事务。
Rather than duplicate the code that defines and manages these properties, you can create a common Account parent class that has a cash balance, and can handle credit and debit transactions.
应用推荐