Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to register generic repository in Unity.
I am doing this
container.RegisterType(typeof(IRepository<>), typeof(Repository<>));
But it is not working

Throwing below exception

Resolution of the dependency failed, type = "StudentManagement.IData.IRepository.IRepository`1[StudentManagement.Models.Model.Studentcontacts]", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type, StudentManagement.IData.IRepository.IRepository`1[StudentManagement.Models.Model.Studentcontacts], is an interface and cannot be constructed. Are you missing a type mapping?
-----------------------------------------------
At the time of the exception, the container was:

Resolving StudentManagement.IData.IRepository.IRepository`1[StudentManagement.Models.Model.Studentcontacts],(none)

urgent help will be highlt appricable
Posted
Comments
dan!sh 3-Mar-14 6:32am    
Can you please post the code where instantiation is done? You can update your question with it and also make sure to wrap it with pre tags for better readability.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900