0

I am working on implementing DI using Unity in Web API Layer. Following is the error message I am getting while calling the Service -

Resolution of the dependency failed, type = "API.Controllers.LeadController", name = "(none)".

Exception occurred while: while resolving.

Exception is: InvalidOperationException - The current type, Business.ILeadManager, is an interface and cannot be constructed. Are you missing a type mapping?


At the time of the exception, the container was:

Resolving API.Controllers.LeadController,(none)

Resolving parameter "leadManager" of constructor API.Controllers.LeadController(Business.ILeadManager leadManager)

Resolving Business.ILeadManager,(none)

Any suggestions, what is wrong ?

1 Answer 1

1

Your unity configuration is missing a mapping for type Business.ILeadManager, so unity does not know which object instance it should create.

There should be an entry for your type like:

<register type="Business.ILeadManager" mapTo="MyLeadManagerImplementation" /> 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.