Skip to content

Instantly share code, notes, and snippets.

@Jonsey
Created March 21, 2011 22:26
Show Gist options
  • Select an option

  • Save Jonsey/880363 to your computer and use it in GitHub Desktop.

Select an option

Save Jonsey/880363 to your computer and use it in GitHub Desktop.
Module initialisation
public class InventoryModule : IModule
{
protected IUnityContainer container;
protected IRegionManager regionManager;
protected InventoryModule(IUnityContainer container, IRegionManager manager)
{
this.container = container;
regionManager = manager;
}
protected override void RegisterTypesAndServices()
{
container
.RegisterType<IInventoryRepository, InventoryRepository>()
.RegisterType<ICountriesRepository, CountriesRepository>();
container
.RegisterType<IMainMenuViewModel, MainMenuViewModel>(new ContainerControlledLifetimeManager())
.RegisterType<IMainMenuView, MainMenuView>(new ContainerControlledLifetimeManager());
}
protected override void RegisterViewsWithRegions()
{
regionManager.RegisterViewWithRegion("TopRegion", typeof(MainMenuView));
regionManager.RegisterViewWithRegion("RightRegion", typeof(IInventoryView));
}
public void Initialize()
{
RegisterTypesAndServices();
RegisterViewsWithRegions();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment