I have a class which I need to use my container to resolve a concrete class from an interface. this class can't take a constructor, so I am trying to resolve the class using the container.Resolve method.
In my UnityHelper, I have setup all my container items, and the one in question is defined as:
container.RegisterType<OAuthAuthorizationServerProvider, AuthorisationServerProvider>();
And then in my startup.cs file, I am attempting to resolve the class based on the interface:
public class Startup { private OAuthAuthorizationServerProvider _authorisationServiceProvider;
public Startup()
{
var _container = UnityConfig.GetConfiguredContainer();
_authorisationServiceProvider = _container.Resolve<OAuthAuthorizationServerProvider>();
}
However, I'm getting a design time error on the 'Resolve'saying that the non-generic method cannot be used with typed arguments.
I've seen places where it seems I am doing it right. Eg: Unity Container Resolve
What am I doing wrong?