Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing MemberInfo to Injection Members to simplify selection #18

Open
ENikS opened this issue Jun 4, 2020 · 0 comments
Open

Comments

@ENikS
Copy link
Contributor

ENikS commented Jun 4, 2020

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.

@ENikS ENikS changed the title Allow passing MethodInfo to InjectionMethod to simplify selection Allow passing MemberInfo to Injection Members to simplify selection Jun 4, 2020
ENikS referenced this issue in unitycontainer/abstractions Jun 4, 2020
ENikS referenced this issue in unitycontainer/abstractions Jun 5, 2020
@ENikS ENikS transferred this issue from unitycontainer/abstractions Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant