title: How to Configure Unity in n-tier ASP .net MVC application
body: <p>I am having a little problem figuring out how to configure Unity IoC container in my n-tier ASP .net MVC application.</p>
  
  <p>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</p>
  
  <p>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.</p>
  
  <p>I have configured a Unity container in my MVC application doing something like this (Global.asax):</p>
  
  <p>container.RegisterType(); //MyService is in my Business Logic Layer</p>
  
  <p>The MyService class uses my repository in its constructor meaning that when one of those MyService classes is created a MyRepository is also required:</p>
  
  <p>public MyService(IRepository repository) : base(repository)
   {       }</p>
  
  <p>As you can see I still have not configured IRepository in my container.</p>
  
  <p>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.</p>
  
  <p>Where is the best place to configure this ? I am kind of confused here....</p>
  
  <p>Thanks in advance.</p>