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

Mugen Injection [Resolving unregistered type]

The MugenInjection supports to resolve unregistered type. To resolve unregistered type you can write behavior.
This code shows how it works:

public class UnregisteredTypeResolver : IResolveUnregisteredTypeBehavior
    #region Implementation of IResolveUnregisteredTypeBehavior

    public bool Resolve(IBindingContext bindingContext, out object result)
        if (bindingContext.Service == typeof (string))
            result = "empty";
            return true;
        result = null;
        return false;


// Create your MugenInjector.
_injector = new MugenInjector();
    .Add<IResolveUnregisteredTypeBehavior>(new UnregisteredTypeResolver());

//s equals to "empty"
var s = _injector.Get<string>();

Leave a Reply
* 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