Question Back ground:
I have a project consisting of a DLL, a web service and a test project. Currently I'm simply trying to set the web service constructor string parameter through the use of Unity.
The issue & error:
The following shows the constructor structure of the web service class 'VersionControlFacade':
private string _url;
public VersionControlService()
{
}
public VersionControlService(string url)
{
_url = url;
}
If I simply pass the 'url' parameter as shown in the following code it is fine:
var newVersionControlFacade = new VersionControlFacade(@"http://somelink.com");
When I try and pass it using my Unity IoC container as shown:
var container = new UnityContainer();
container.RegisterType<IVersionControlFacade, ProxyHandler>();
container.RegisterType<Proxy>();
container.RegisterType<VersionControlService>(new InjectionConstructor(@"http://somelink.com"));
return container.Resolve<IVersionControlFacade>();
The following error is being throw stating that the web service does not contain a constructor that takes a string parameter even though it clearly does.:
Result Message:
Test method Test_Unity threw exception: System.InvalidOperationException: The type VersionControl.WebService.VersionControlService does not have a constructor that takes the parameters (String).
Can anyone steer me in the right direction here? Do I need to re-add the web reference for it to see this new constructor?