/// <summary> /// Retrieve the root "Schema" node for current node. If there is no root mapping node, this will return null. /// </summary> internal override XNamespace GetRootNamespace(EFObject node) { var currNode = node; EFRuntimeModelRoot runtimeModel = null; EFDesignerInfoRoot designerInfo = null; XNamespace ns = null; while (currNode != null) { runtimeModel = currNode as EFRuntimeModelRoot; designerInfo = currNode as EFDesignerInfoRoot; if (runtimeModel != null) { ns = runtimeModel.XNamespace; break; } else if (designerInfo != null) { ns = designerInfo.XNamespace; break; } else { currNode = currNode.Parent; } } return(ns); }
private void ResolveParentEFObject() { var parent = _xmlChange.Node.Parent; if (parent != null) { // get the parent EFObject for the changed object _parentOfChangedEFObject = ModelItemAnnotation.GetModelItem(parent); } // in case of a 'delete' change, then the changed XObject's parent will be null so we should try to // resolve the parent through our model tree. if (_parentOfChangedEFObject == null) { // try another way to get the parent if (ChangedEFObject != null) { _parentOfChangedEFObject = ChangedEFObject.Parent; } } #if DEBUG if (_parentOfChangedEFObject == null) { if (_expectEFObjectParentForXObject != null && _expectEFObjectParentForXObject(_xmlChange.Node)) { Debug.Fail("Why weren't we able to find the parent of the changed EFObject?"); } } #endif }
internal void RemoveErrorsForEFObject(EFObject efobject, ErrorClass errorClass, int errorCodeToRemove) { Dictionary <ErrorClass, ICollection <ErrorInfo> > errorClass2ErrorInfo = null; _artifacts2Errors.TryGetValue(efobject.Artifact, out errorClass2ErrorInfo); if (errorClass2ErrorInfo != null) { foreach (var errors in GetErrorInfosUsingMask(errorClass2ErrorInfo, errorClass)) { var errorsToRemove = new List <ErrorInfo>(); foreach (var errorInfo in errors) { if (errorInfo.ErrorCode == errorCodeToRemove) { errorsToRemove.Add(errorInfo); } } foreach (var errorInfo in errorsToRemove) { errors.Remove(errorInfo); } } } }
public ExternalXMLModelChange(IXmlChange xmlChange, ExpectEFObjectParentForXObject assertDelegate) { _xmlChange = xmlChange; _changedEFObject = ModelItemAnnotation.GetModelItem(_xmlChange.Node); _expectEFObjectParentForXObject = assertDelegate; ResolveParentEFObject(); }
protected static void ClearEFObject(EFObject efObjectToClear) { if (efObjectToClear != null) { efObjectToClear.Dispose(); } }
internal void RemoveErrorsForEFObject(EFObject item) { Debug.Assert(item.Artifact != null); if (item.Artifact == null) { return; } if (_artifacts2Errors.ContainsKey(item.Artifact)) { var errorClass2ErrorInfo = _artifacts2Errors[item.Artifact]; foreach (var errorsForClass in errorClass2ErrorInfo.Values) { // store these off because we can't remove while iterating var errorsToRemove = new List <ErrorInfo>(); // find any errors that reference the passed in item foreach (var errorInfo in errorsForClass) { if (errorInfo.Item == item) { errorsToRemove.Add(errorInfo); } } // go remove the ones we found foreach (var removeMe in errorsToRemove) { errorsForClass.Remove(removeMe); } } } }
internal void RemoveParseErrorsForObject(EFObject obj) { if (_errors == null) { return; } if (_errors.ContainsKey(obj)) { _errors.Remove(obj); } }
internal static EFRuntimeModelRoot RuntimeModelRoot(this EFObject thisObject) { var item = thisObject.Parent; while (item != null && item.Parent != null) { if (item is EFRuntimeModelRoot) { break; } item = item.Parent; } return item as EFRuntimeModelRoot; }
private void CheckObjectToRenormalize(EFObject efObject, ref List <EFContainer> containersToRenormalize) { var efContainer = efObject as EFContainer; if (efContainer != null) { if (efContainer.State != EFElementState.Resolved) { containersToRenormalize.Add(efContainer); } foreach (var child in efContainer.Children) { CheckObjectToRenormalize(child, ref containersToRenormalize); } } }
internal void AddParseErrorForObject(EFObject obj, ErrorInfo errorInfo) { Debug.Assert(errorInfo.ErrorClass == ErrorClass.ParseError, "Unexpected error class added to EFObject"); Debug.Assert(errorInfo.Item == obj, "ErrorInfo for wrong object added to EFObject"); if (_errors == null) { _errors = new Dictionary <EFObject, ICollection <ErrorInfo> >(); } ICollection <ErrorInfo> errorCollection; if (!_errors.TryGetValue(obj, out errorCollection)) { errorCollection = new List <ErrorInfo>(); _errors.Add(obj, errorCollection); } errorCollection.Add(errorInfo); }
internal static XNamespace GetRootNamespace(EFObject node) { var currNode = node; EFDesignerInfoRoot model = null; XNamespace ns = null; while (currNode != null) { model = currNode as EFDesignerInfoRoot; if (model != null) { ns = model.XNamespace; break; } else { currNode = currNode.Parent; } } return(ns); }
internal void AddParseErrorForObject(EFObject obj, string errorMessage, int errorCode) { var ei = new ErrorInfo(ErrorInfo.Severity.ERROR, errorMessage, obj, errorCode, ErrorClass.ParseError); AddParseErrorForObject(obj, ei); }
internal ICollection <EFObject> GetAntiDependenciesClosure(EFObject item) { return(_dependencyGraph.GetAntiDependenciesClosure(item)); }
/// <summary> /// Removes a dependency from this element. Also updates element's anti-dependency list. /// </summary> /// <param name="element"></param> internal void RemoveDependency(EFObject item, EFObject dependency) { _dependencyGraph.RemoveDependency(item, dependency); }
/// <summary> /// Adds an dependency to this Element. Also updates element's Anti-dependency list /// </summary> /// <param name="element"></param> internal void AddDependency(EFObject item, EFObject dependency) { _dependencyGraph.AddDependency(item, dependency); }
internal abstract XNamespace GetRootNamespace(EFObject node);