I am implementing dependency injection in my project using unity. And to register type i have created another project (LibraryManagement.DIMapping) which has registsered type for all layers(Business, Data) and added its reference in presentation layer. Issue am facing here is how to configure unity container in global.asax. so that container will be avaliable in all different layers. Do i need to d any setting in web.config file since i have already registered mapping in cs file? Here is the screenshot of DIRegister class<pre></pre>
public IUnityContainer InitializeMapping() { IUnityContainer container = new UnityContainer(); //Business Layer container.RegisterType<ICourseManager, CourseManager>(); container.RegisterType<IEnrollmentManager, EnrollmentManager>(); container.RegisterType<IStateManager, StateManager>(); container.RegisterType<IStudentManager, StudentManager>(); //Data layer container.RegisterType<IStudentRepository, StudentRepository>(); container.RegisterType(typeof(IRepository<>), typeof(Repository<>)); container.RegisterType<ICourseRepository, CourseRepository>(); container.RegisterType<IEnrollmentRepository, EnrollmentRepository>(); return container; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)