Beispiel #1
0
        public void TestSingletonByName()
        {
            var container = new CryoContainer();

            container.RegisterSingleton <MyClazz>("MyClazz");

            Assert.IsNull(container.TryResolveByName <MyClazz>("MyClazz"));
            var clazz = container.ResolveByName <MyClazz>("MyClazz");

            Assert.IsNotNull(clazz);

            var clazz2 = container.TryResolveByName <MyClazz>("MyClazz");

            Assert.IsNotNull(clazz2);
            Assert.AreSame(clazz, clazz2);

            Assert.IsNull(container.TryResolve <MyClazz>());
        }
Beispiel #2
0
 public T Resolve(params object[] parameters)
 {
     return(_container.TryResolveByName <T>(_name, parameters));
 }
Beispiel #3
0
 public object WeakGetObject(CryoContainer container, params object[] parameters)
 {
     return(container.TryResolveByName <T>(_name, parameters));
 }