Пример #1
0
        public void DependenciesShouldGetResolvedInNamedScope()
        {
            var rootBuilder = new ContainerBuilder();
            rootBuilder.RegisterDependencyResolver().InstancePerMatchingLifetimeScope("shell");
            var rootContainer = rootBuilder.Build();

            var scope = rootContainer.BeginLifetimeScope("shell");
            var connMgr = scope.Resolve<IConnectionManager>();

            Assert.That(connMgr, Is.Not.Null);

            var container = scope.Resolve<IDependencyResolver>();

            Assert.That(container, Is.Not.Null);
        }
Пример #2
0
 protected override void Load(ContainerBuilder moduleBuilder)
 {
     moduleBuilder.RegisterDependencyResolver().InstancePerMatchingLifetimeScope("shell");
 }