Exemplo n.º 1
0
        public object CreateInstance()
        {
            Exception = null;

            object handle = CacheItemCtor.DefaultConstruct(ItemType);

            if (handle == null)
            {
                Exception = getE("Constructor", ExcelName, "Default");
            }

            return(handle);
        }
Exemplo n.º 2
0
        public CacheItemCtor Constructor(string ConstructorName)
        {
            Exception = null;

            CacheItemCtor ci = extractCtor(ConstructorName);

            if (ci == null)
            {
                Exception = getE("Constructor", ExcelName, ConstructorName);
            }

            return(ci);
        }
Exemplo n.º 3
0
        private void loadAllCtors()
        {
            if (!_allCtor)
            {
                ConstructorInfo[] pi = CU.ExcelRegisteredCtors(ItemType);
                if (pi.GetLength(0) != _ctor.Count)
                {
                    foreach (ConstructorInfo m in pi)
                    {
                        CacheItemCtor c = new CacheItemCtor(m);
                        if (!_ctor.ContainsKey(c.ExcelName))
                        {
                            _ctor.Add(c.ExcelName, c);
                        }
                    }
                }

                _allCtor = true;
            }
        }
Exemplo n.º 4
0
        public object CreateInstance(string Constructor, object[] o)
        {
            Exception = null;

            CacheItemCtor ci = extractCtor(Constructor);

            object handle = null;

            if (ci != null)
            {
                handle    = ci.Construct(o);
                Exception = ci.Exception;
            }
            else
            {
                Exception = getE("Constructor", ExcelName, Constructor);
            }

            return(handle);
        }
Exemplo n.º 5
0
        private CacheItemCtor extractCtor(string name)
        {
            CacheItemCtor c = null;

            if (!_ctor.ContainsKey(name))
            {
                IEnumerable <ConstructorInfo> ci = CU.ExcelRegisteredCtors(ItemType)
                                                   .Where(w => new CacheItemCtor(w).ExcelName == name);

                if (ci.Count() > 0)
                {
                    c = new CacheItemCtor(ci.First());
                    _ctor.Add(name, c);
                }
            }
            else
            {
                c = _ctor[name];
            }

            return(c);
        }
Exemplo n.º 6
0
        public override bool Equals(object obj)
        {
            CacheItemCtor m = obj as CacheItemCtor;

            return(this.ToString().Equals(m.ToString()));
        }