Transactions in the Repository Pattern

后端 未结 6 882
小鲜肉
小鲜肉 2020-12-12 18:07

How do I encapsulate the saving of more than one entity in a transactional manner using the repository pattern? For example, what if I wanted to add an order and update the

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 18:22

    You want to look at implementing the unit of work pattern. There are implementations out there for NHibernate. One is in the Rhino Commons project, there's also the Machine.UoW.

提交回复
热议问题