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

Alternative to MEF plugins #531

Open
WonkySoft opened this issue May 22, 2020 · 3 comments
Open

Alternative to MEF plugins #531

WonkySoft opened this issue May 22, 2020 · 3 comments

Comments

@WonkySoft
Copy link

I have reflection code that lets me scan/load any assembly that has methods that meet a given signature and create proxies to those methods. It doesn't rely on any defined interface or attributes on the methods. I'm pretty sure I can achieve the same thing with MEF 1.0 and attributes, but ConventionBuilder in MEF 2.0 isn't documented well enough to determine if I can achieve the same thing without attributes.

So my question is, can this be (easily) achieved with LightInject? If so, can someone provide a simple example.

@seesharper
Copy link
Owner

Hi @WonkySoft Could you come with a simple example/repro of what you are trying to do? 😊

@WonkySoft
Copy link
Author

WonkySoft commented May 26, 2020

Say each one of these is defined in a separate assembly:

public static class StaticThing
{
    public static Task<bool> MyStaticMethod() =>
        Task.FromResult(true);
}

public class InstanceThing
{
    public Task<bool> MyInstanceMethod() =>
        Task.FromResult(true);
}

public class InstanceWithStaticThing
{
    public static Task<bool> MyStaticMethod() =>
        Task.FromResult(true);
}

I want to be able to discover and proxy said methods from their assemblies in a given path based on method signature match, which in this case is something like Func<Task<bool>>.

@WonkySoft
Copy link
Author

Was the information I added sufficient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants