I am having a little problem figuring out how to configure Unity IoC container in my n-tier ASP .net MVC application.
I have 3 projects in my solution: 1. MVC (Used as View) : Has referene to Business Logic Layer only 2. Business Logic Layer: Has reference to Repository project only 3. Respository: Do not have reference to any of the above projects
Please notice the way my reference work, I have done it like this so I will be able to replace the communication between my tiers using WCF with less difficulties.
I have configured a Unity container in my MVC application doing something like this (Global.asax):
container.RegisterType(); //MyService is in my Business Logic Layer
The MyService class uses my repository in its constructor meaning that when one of those MyService classes is created a MyRepository is also required:
public MyService(IRepository repository) : base(repository) { }
As you can see I still have not configured IRepository in my container.
I don't want to do it in my Global.asax because i dont want to add any reference of Repository to MVC (View) tier.
Where is the best place to configure this ? I am kind of confused here....
Thanks in advance.