It is chance define some singleton variable in asp.net mvc3 ?
I want define it (probably in global.asax) and then in controllers get it, by IOC resolver (structureMap)
Simple: I want have one property with same data for all users, not dependency on request, session, … For example At first start of MVC application I set DateTime value into this property and then all requests can view this property and modified this property in controllers.
Just use StructureMap to create your controllers using a dependency resolver like outlined in this blog post. Inject not the variable directly but an instance that holds that variable:
Now you can inject GlobalScope into your controllers and set/get the Variable but keep in mind that you’re in a multi threaded environment where read and write access to variables must be synchronized or you run into some weird race conditions.