About .NET, ASP.NET, MVC, C#, WPF, WCF and everything related to .NET and more.

Mugen Injection [ThreadScopeLifecycle]

ThreadScopeLifecycle - instances activated via the binding should be re-used within the same thread.

// Create your MugenInjector.
_injector = new MugenInjector();
_injector.Bind<Alpha>().ToSelf().InThreadScope();

var alpha1 = _injector.Get<Alpha>();
// This is a same instance.
var alpha2 = _injector.Get<Alpha>();
ThreadPool.QueueUserWorkItem(state =>
                                 {
                                     //This is a different instance.
                                     var alpha = _injector.Get<Alpha>();
                                 });

Comments
Leave a Reply
*bold*
_italics_
+underline+
* Bullet List
** Bullet List 2
# Number List
## Number List 2
{"Do not apply formatting"}
{code:language} code here {code:language}.
Supports: aspx c#, c#, c++, html, sql, xml
[url:http://www.example.com]