public object CreateInstance() { Exception = null; object handle = CacheItemCtor.DefaultConstruct(ItemType); if (handle == null) { Exception = getE("Constructor", ExcelName, "Default"); } return(handle); }
public CacheItemCtor Constructor(string ConstructorName) { Exception = null; CacheItemCtor ci = extractCtor(ConstructorName); if (ci == null) { Exception = getE("Constructor", ExcelName, ConstructorName); } return(ci); }
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; } }
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); }
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); }
public override bool Equals(object obj) { CacheItemCtor m = obj as CacheItemCtor; return(this.ToString().Equals(m.ToString())); }