What exactly is “persistence ignorance”?

后端 未结 8 2141
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-01 05:01

Persistence ignorance is typically defined as the ability to persist & retrieve standard .NET objects (or POCOs if you really insist on giving them a name). And a seemin

8条回答
  •  执念已碎
    2020-12-01 05:38

    I'd agree with your definition:

    Is it therefore reasonable to say that "persistence ignorance" is true when objects facilitate the use of a persistence framework, but do not perform any persistence logic themselves?

    The code (as opposed to atributes) in your classes has no features that are intrinsic to persistence. Default constructors might be needed for persistence, but have no code that actually does persistence. The persistence layer could be changed quite substantially, different databases could be used and the business logic would remain unchanged.

提交回复
热议问题