Constructor injection wird issue ResolutionFailedException

  • Thread starter Thread starter wakefun
  • Start date Start date
W

wakefun

Guest
Dear all,

I am building a wrapper around a WCF service client which is based on Service Reference

WHn registering my claas and interface using unity I am doing it as below :

container.RegisterType<ITestPocDataService, WcfTestPocDataService>(new InjectionConstructor(
new object[] { new ServiceReference.DataServiceClient("SecureTcpTranportMsgUsingCustomUser") }));

At the time I try to reolve the created instance using code below

var _instance=container.Resolve<WcfTestPocDataService>();

I get an excpetion saying :

Unity.Exceptions.ResolutionFailedException: 'Resolution of the dependency failed, type = 'Client.Factory.WcfTestPocDataService', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type DataServiceClient has multiple constructors of length 2. Unable to disambiguate.
-----------------------------------------------
At the time of the exception, the container was:
Resolving Client.Factory.WcfTestPocDataService,(none)
Resolving parameter 'client' of constructor Client.Factory.WcfTestPocDataService(Client.ServiceReference.DataServiceClient client)
Resolving Client.ServiceReference.DataServiceClient,(none)
'

And inner exception :
InvalidOperationException: The type DataServiceClient has multiple constructors of length 2. Unable to disambiguate.

Any idea how to selved ? as I am specifying teh constructor 2 used I wonder why I get that error

regards

Continue reading...
 
Back
Top