Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Azadehkhojandi/234a85f1e7fee739e8096199c5608052 to your computer and use it in GitHub Desktop.
Save Azadehkhojandi/234a85f1e7fee739e8096199c5608052 to your computer and use it in GitHub Desktop.
Umbraco and unity
var container = new UnityContainer();
container.RegisterTypes(AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()));
container.RegisterTypes(AllClasses.FromLoadedAssemblies());
container.RegisterInstance(typeof(UmbracoHelper), new UmbracoHelper(UmbracoContext.Current));
container.RegisterInstance(typeof(UmbracoContext), UmbracoContext.Current);
container.RegisterInstance(typeof(Merchello.Core.IMerchelloContext), MerchelloContext.Current);
container.RegisterInstance(typeof(ApplicationContext), ApplicationContext.Current);
container.RegisterInstance(typeof(ServiceContext), ApplicationContext.Current.Services);
container.RegisterInstance(typeof(Umbraco.Core.Services.IMemberService), ApplicationContext.Current.Services.MemberService);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment