How to add these Autofac registrations to the umbraco 5 AbstractContainerBuilder?
Hello,
Could anyone please help me rewrite these Autofac.ContainerBuilder registrations to work with the Umbraco.Framework.DependecyManagement.AbstractContainerBuilder returned by the CreateContainerBuilder method in the Global.ascx file?
ContainerBuilder autoFacContainerBuilder = new ContainerBuilder();
// Unit of Work & ObjectContext - Autofac DI Registration autoFacContainerBuilder.RegisterType<EFUnitOfWork>().As<IUnitOfWork>(); autoFacContainerBuilder.RegisterType<ObjectContextAdapter>().As<IObjectContext>(); autoFacContainerBuilder.Register(c => new YourWebsiteEntities()).As<ObjectContext>().InstancePerLifetimeScope();
How to add these Autofac registrations to the umbraco 5 AbstractContainerBuilder?
Hello,
Could anyone please help me rewrite these Autofac.ContainerBuilder registrations to work with the Umbraco.Framework.DependecyManagement.AbstractContainerBuilder returned by the CreateContainerBuilder method in the Global.ascx file?
ContainerBuilder autoFacContainerBuilder = new ContainerBuilder();
autoFacContainerBuilder.RegisterGeneric(typeof(EFRepository<>)).As(typeof(IRepository<>));
autoFacContainerBuilder.RegisterGeneric(typeof(EFReadOnlyRepository<>)).As(typeof(IReadOnlyRepository<>));
autoFacContainerBuilder.RegisterType<ClientEFRepository>().As<IClientRepository>();
autoFacContainerBuilder.RegisterType<CustomWebsiteTemplateEFRepository>().As<ICustomWebsiteTemplateRepository>();
autoFacContainerBuilder.RegisterType<GenericWebsiteTemplateEFRepository>().As<IGenericWebsiteTemplateRepository>();
autoFacContainerBuilder.RegisterType<GoogleFontEFRepository>().As<IGoogleFontRepository>();
autoFacContainerBuilder.RegisterType<WebsiteEFRepository>().As<IWebsiteRepository>();
// Unit of Work & ObjectContext - Autofac DI Registration
autoFacContainerBuilder.RegisterType<EFUnitOfWork>().As<IUnitOfWork>();
autoFacContainerBuilder.RegisterType<ObjectContextAdapter>().As<IObjectContext>();
autoFacContainerBuilder.Register(c => new YourWebsiteEntities()).As<ObjectContext>().InstancePerLifetimeScope();
// Services - Autofac DI Registration
autoFacContainerBuilder.RegisterType<ClientService>().As<IClientService>();
autoFacContainerBuilder.RegisterType<CustomWebsiteTemplateService>().As<ICustomWebsiteTemplateService>();
autoFacContainerBuilder.RegisterType<GenericWebsiteTemplateService>().As<IGenericWebsiteTemplateService>();
autoFacContainerBuilder.RegisterType<GoogleFontService>().As<IGoogleFontService>();
autoFacContainerBuilder.RegisterType<WebsiteService>().As<IWebsiteService>();
I'm really stuck. So any help or pointers would be really appreciated. Thanks
Dean
is working on a reply...