What exactly is “persistence ignorance”?

后端 未结 8 2132
佛祖请我去吃肉
佛祖请我去吃肉 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:48

    In my opinion, "persistence ignorance" is a property of your model (domain model, business model or whatever you might refer to it as). The model is persistence ignorant because it retrieves instances of the entities it contains through abstractions (sometimes referred to as repositories). These abstractions can be implemened by using an ORM directly, but as you state yourself this may sometimes add requirements to the objects that do not naturally belong in your model. Therefore I would not say that a model that adheres to some requirements of a specific ORM is 100% persistence ignorant.

提交回复
热议问题