I've started a project usinjg MS Unity as my IOC container and have two questions regarding overriding parameters.
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;
}
1) How do i set up the Tab type in unity so that i can pass in true or false to the AllowVisible property as a paramater? I dont want to have to add the additional line of tab.AllowVisible = true; as in the case below
void Main()
{
   ITab tab = unityContainer.RegisterType<ITab, Tab>(); 
   tab.AllowVisible = true;
}
2) If i already have an instance of the ViewModel, such as vm in the case below, how do i make the container resolve the Tab object while passing in the vm object into its constructor? Currently when i resolve for the tab object, the container creates another instance of the ViewModel. I want the vm instance to get used as the tab objects viewmodel?
void Main()
{
    unityContainer.RegisterType<IViewModel, ViewModel>();
    unityContainer.RegisterType<ITab, Tab>();
   ViewModel vm = unityContainer.Resolve<IViewModel>();   
   ITab tab = unityContainer.RegisterType<ITab, Tab>(); 
}
 
     
    