LifetimeScopeBeginLifetimeScope Method (Object, ActionContainerBuilder) |
Namespace: Autofac.Core.Lifetime
public ILifetimeScope BeginLifetimeScope( Object tag, Action<ContainerBuilder> configurationAction )
IContainer cr = // ... using (var lifetime = cr.BeginLifetimeScope("unitOfWork", builder => { builder.RegisterType<Foo>(); builder.RegisterType<Bar>().As<IBar>(); }) { var foo = lifetime.Resolve<Foo>(); }