Esempio n. 1
0
        public object GetSingleton(Type t, object[] arguments = null)
        {
            object obj = null;

            try
            {
                if (objectPool.ContainsKey(t.Name) == false)
                {
                    obj = InstanceCreationService.GetInstance().GetNewObject(t, arguments);
                    objectPool.Add(t.Name, obj);
                }
                else
                {
                    obj = objectPool[t.Name];
                }
            }
            catch
            {
            }

            return(obj);
        }
Esempio n. 2
0
        private object CreateInstance(RegistrationModel model, object[] arguments = null)
        {
            object returnedObj  = null;
            Type   typeToCreate = model.ObjectType;

            returnedObj = model.Flag ? SingletonCreationService.GetInstance().GetSingleton(typeToCreate, arguments): InstanceCreationService.GetInstance().GetNewObject(typeToCreate, arguments);

            SetterInject(typeToCreate, returnedObj);

            return(returnedObj);
        }