Manage the lifetime of dbContext

前端 未结 5 1544
太阳男子
太阳男子 2020-12-31 09:56

I would like to tie the lifetime of a dbContext to the lifetime of a session, to - for example - be able to commit or abandon changes on a group of mutations on the dbcontex

5条回答
  •  情书的邮戳
    2020-12-31 10:35

    Typically in this scenario you need keep changes in temporary store(like session or cookie or database). When you need to save result or view new data you get old data and changes and build new object. Changes can be stored as new object or sequence of actions. Be carfule when apply changes, data conflict may be occure. Of cource use Context\Request

提交回复
热议问题