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

Mugen Injection [Passing parameters]

All methods to resolve accepts parameters using a variable-length argument list. This will map automatically to the named constructor parameters on the implementation class, if it was registered using Reflection, e.g.:

public class Alpha
{
    public Alpha(string test)
    {
        
    }
}

var alpha = _injector.Get<Alpha>(new ConstructorParameter("test", "test"));
var enumerable = _injector.GetAll<Alpha>(new ConstructorParameter("test", "test"));

Available parameter types

All parameters implements the IInjectionParameter interface and you easily can write your implementation.
The MugenInjection offers several different parameter:
  • ConstructorParameter - represents the value of a constructor argument.
  • PropertyParameter - represents the value of a property.
  • MethodParameter - represents the value of a method argument.
  • InjectionParameter - represents the base class for parameters.
In the ConstructorParameter, PropertyParameter and MethodParameter matching strategies depends on constructor that you use to create parameter. It may depends from parameter position (ConstructorParameter, MethodParameter), parameter name (all parameter types) and parameter type (all parameter types).
The InjectionParameter matching strategies depends only from you, you pass a delegate which is responsible for the parameter-selection.

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]