-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
If a factory interface has a generic method it throws ActivationException when you try to create dependency by this method.
public interface IRecieverFactory
{
IReciever<TData> Get<TData>();
}
kernel.Bind<IRecieverFactory>().ToFactory()
StandardInstanceProvider resolves it to named binding with empty name.
I solved this problem by overriding GetName:
public class GenericFactoryMethodInstanceProvider : StandardInstanceProvider
{
protected override string GetName(MethodInfo methodInfo, object[] arguments)
{
return null;
}
}
kernel.Bind<IRecieverFactory>().ToFactory(() => new GenericFactoryMethodInstanceProvider());
This is a bug I think.
Metadata
Metadata
Assignees
Labels
No labels