title: overriding object parameters using UNITY
body: <p>I've started a project usinjg MS Unity as my IOC container and have two questions regarding overriding parameters.</p>
  
  <pre><code>public interface ITab
  {
     bool AllowVisible {get;set;}
  }
  
  class Tab : ITab
  {
    IViewModel vm;
  
    public Tab(IViewModel vm)
    {
      this.vm = vm; 
    }
  
    public bool allowVisible = false;
  
    public bool AllowVisible
    {
      get{ return allowVisible};
      set{ allowVisible = vlaue};
    }
  } 
  
  public interface IViewModule
  {
    string Name;
  }
  
  public class ViewModel
  {
    public string Name;
  }
  </code></pre>
  
  <p>1)  How do i set up the <strong>Tab</strong> type in unity so that i can pass in true or false to the <strong>AllowVisible</strong> property as a paramater? I dont want to have to add the 
  additional line of <strong>tab.AllowVisible = true;</strong> as in the case below</p>
  
  <pre><code>void Main()
  {
     ITab tab = unityContainer.RegisterType&lt;ITab, Tab&gt;(); 
     tab.AllowVisible = true;
  }
  </code></pre>
  
  <p>2) If i already have an instance of the ViewModel, such as <strong>vm</strong> in the case below, how do i make the <strong>container</strong> resolve the <strong>Tab</strong> object while passing in the <strong>vm</strong> object into its constructor?  Currently when i resolve for the <strong>tab</strong> object, the <strong>container</strong> creates another instance of the ViewModel.  <strong>I want the vm instance to get used as the tab objects viewmodel?</strong></p>
  
  <pre><code>void Main()
  {
      unityContainer.RegisterType&lt;IViewModel, ViewModel&gt;();
      unityContainer.RegisterType&lt;ITab, Tab&gt;();
  
     ViewModel vm = unityContainer.Resolve&lt;IViewModel&gt;();   
     ITab tab = unityContainer.RegisterType&lt;ITab, Tab&gt;(); 
  }
  </code></pre>