阅读背景:

Ninject on asp.net Session state

来源:互联网 

I'm working with Ninject on a web application, using the BasePage and BaseMaster from the frameworks's integrations. What I would like to do is have an object injected and have a new instance created on each session. I've looked at the OnePerRequest behavior and it's close, but not quite. What I'm doing is performing a lot of calculations, and those variables are held in objects that are injected into the page. I need those objects to stay around for postbacks, but I want a new instance of the objects each time the user "Visits" the site. My initial thinking was to use the Asp.net Session object in some way to store the values between postbacks, This is the way I would do it before Ninject (just store the objects in session. but I'd like to use Ninject in the correct way if I can. I'm open to other suggestions. I thought about using the Singleton, but each user is going to need their own copy of the object, otherwise they'll step on each others calculations.I'm working with Ninject on a web application,




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: