Registering With Autofac Container in Global.asax equivelant to StructureMap?
Hello All,
I'm using umbraco 5.
I have overriden the CreateContainerBuilder method in glabal asax and have called base.CreateContainerBuilder() to get access to a variable of it's return type, AbstractContainerBuilder.
I've then used this variable to register my dependencies.
public class Global : MvcApplication { protected override Umbraco.Framework.DependencyManagement.AbstractContainerBuilder CreateContainerBuilder() { var container = base.CreateContainerBuilder();
I'm following a tutorial on IOC/DI and that uses StructureMap as it's container. There is a registration that i'd like to place inside the method above but I don't know how to write it for Autofac and in the context of that AbstractContainerBuilder.
The structure map line looks like this: For<ObjectContext>().HybridHttpOrThreadLocalScoped().Use(() => new Entities());
Can anyone please translate that line into something I can use in the umbraco scenario?
Registering With Autofac Container in Global.asax equivelant to StructureMap?
Hello All,
I'm using umbraco 5.
I have overriden the CreateContainerBuilder method in glabal asax and have called base.CreateContainerBuilder() to get access to a variable of it's return type, AbstractContainerBuilder.
I've then used this variable to register my dependencies.
public class Global : MvcApplication
{
protected override Umbraco.Framework.DependencyManagement.AbstractContainerBuilder CreateContainerBuilder()
{
var container = base.CreateContainerBuilder();
container.For(typeof(EFRepository<>)).KnownAs(typeof(IRepository<>));
return container;
}
I'm following a tutorial on IOC/DI and that uses StructureMap as it's container. There is a registration that i'd like to place inside the method above but I don't know how to write it for Autofac and in the context of that AbstractContainerBuilder.
The structure map line looks like this: For<ObjectContext>().HybridHttpOrThreadLocalScoped().Use(() => new Entities());
Can anyone please translate that line into something I can use in the umbraco scenario?
Any assistance greatly appreciated
Dean
is working on a reply...