public IMappingObject GetMappingObject(DataItem item) { if (!(item is Mapping)) { Log.Warn(string.Format("Item ({0}): Should be a \"Mapping\", but is a \"{1}\"", this.GetURL(item), item.GetType().Name)); return(null); } Type type = item.GetNodeType(); if (type == null) { Log.Warn(string.Format("Item ({0}): Type '{1}' not found", this.GetURL(item), new MappingWrapper((item as Mapping), this).GetOrDef("type", "NO TYPE DEFINED") )); return(null); } if (!type.IsIMappingObject()) { Log.Warn(string.Format("Item ({0}): Type '{1}' is not castable to 'IMappingObject'", this.GetURL(item), type.Name)); return(null); } IMappingObject obj = null; if (item.GetAnchor() != null) { if (this._refObjects.ContainsKey(item.GetAnchor())) { obj = this._refObjects[item.GetAnchor()]; } } if (obj == null) { obj = (IMappingObject)Activator.CreateInstance(type); obj.ReadMapping(new MappingWrapper(item as Mapping, this), this); if (item.GetAnchor() != null && !this._refObjects.ContainsKey(item.GetAnchor())) { this._refObjects.Add(item.GetAnchor(), obj); } } return(obj); }