Skip to content

Allow passing MemberInfo to Injection Members to simplify selection #18

@ENikS

Description

@ENikS

Description

Currently InjectionMethod only accepts "Name" of the method and tries to determine proper member based on parameters sent with the registration.

Problem

The selection process is rather involved operation and could add significant overhead to execution time.

Solution

In many cases performance could be improved if MethodInfo of the desired method is passed to the constructor. With that the developer would no longer be required to specify all parameters and only pass these that require specific resolution instructions.

For example, method InvokedMethod(string first, int second, int optional = 0) could be specified like this:

var info = typeof(xyz).GetMethod(nameof(xyz.InvokedMethod))
var invoke = new InjectionMethod(info, Inject.Parameter("first parameter"))
container.RegisterType(... invoke)

Impact

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions