Entity framework context as static

后端 未结 3 951
小蘑菇
小蘑菇 2020-11-29 06:09

In a web application it would be ok if i declare the context of a entity framework model as static? it would be ok? its not recommended? why? Thanks!

3条回答
  •  一生所求
    2020-11-29 07:11

    I had done this the first time I implemented the entity framework. The problem was that the whole application was getting "completed" events so I had to do a lot of code figuring out where the call came from.

    I decided to refactor so each page would have an instance of the context. I like it much better now.

    /my experience

提交回复
热议问题