开发者

MVC 2.0 c# asp.net 4.0 Instantiate an object from a library shared in the session

开发者 https://www.devze.com 2023-04-04 07:05 出处:网络
I\'m trying to use the MVC 2.0 framework to instantiate an object of a library. I want to be able to instantiate this object every time I navig开发者_JAVA技巧ate my application with a differnt browse

I'm trying to use the MVC 2.0 framework to instantiate an object of a library.

I want to be able to instantiate this object every time I navig开发者_JAVA技巧ate my application with a differnt browser (creating new session) and call methods on this object from my controllers mantaining separated the objects of different sessions.

Where do I have to store and instantiate my object?

Thanks


If the object's scope is session then I'd store it in the session cache.

You'll want to test in the controller's constructor if it exists, if not then create and store in the session.

0

精彩评论

暂无评论...
验证码 换一张
取 消