I’m having trouble resolving an type with unity. I have a service that takes a Uri and bool.
Foo(Uri uri, bool bar)
When I try and resolve Foo Unity complains
The type Uri has multiple constructors of length 2. Unable to disambiguate
I tried to RegisterInstance but to no avail.
What am I missing?
If your class has more than one constructor that takes two arguments you would have to specify which one Unity should use.
If your constructor takes primitive arguments like strings, bools or URIs you would either have to register your mapping with these arguments or provide them at resolve time.
or
should work. Although I would not recommend the second approach. A DI container should not be used in that manner.