LifetimeScopeBeginLifetimeScope Method (ActionContainerBuilder) |
Namespace: Autofac.Core.Lifetime
IContainer cr = // ... using (var lifetime = cr.BeginLifetimeScope(builder => { builder.RegisterType<Foo>(); builder.RegisterType<Bar>().As<IBar>(); }) { var foo = lifetime.Resolve<Foo>(); }