Reputation: 3772
I am trying to use MEF to load plugins into a DI framework. There are multiple types such as:
ISocket
IBroadcastSocket
INodeTask
Currently I have setup my code this way:
[Import]
INodeTask NodeTaskPlugin { get; set; }
And trying to import the plugin like so:
Injector.Instance.Bind<typeof(INodeTask), NodeTaskPlugin.GetType()>();
When trying the above line of code, R# complains that it cannot find the right method:
Cannot find method group. Did you intend to invoke the method?
Here is the Bind
declaration that I wish to use:
void Bind<TBase, TDerived>() where TDerived : TBase
My question is then two fold:
Upvotes: 0
Views: 128
Reputation: 172825
Use the non-generic Bind
overload of your DI container:
Bind(typeof(INodeTask), NodeTaskPlugin.GetType());
Upvotes: 1