internal void Load(XElement xelement, Version version) { _reservedNamespaces = new HashSet <string>(); _xElement = xelement; foreach (var n in SchemaManager.GetAllNamespacesForVersion(version)) { _reservedNamespaces.Add(n); } }
protected internal override HashSet <string> GetNamespaces() { if (_namespaces == null) { _namespaces = new HashSet <string>(); foreach (var n in SchemaManager.GetAllNamespacesForVersion(SchemaVersion)) { _namespaces.Add(n); } } return(_namespaces); }
protected internal override bool ExpectEFObjectForXObject(XObject xobject) { var xe = xobject as XElement; if (xe != null) { foreach (var n in SchemaManager.GetEDMXNamespaceNames()) { // see if this element is the "Edmx" element. We don't exepct a EFObject for this element if (xe.Name.NamespaceName.Equals(n, StringComparison.OrdinalIgnoreCase)) { if (xe.Name.LocalName.Equals("Edmx", StringComparison.OrdinalIgnoreCase)) { return(false); } } } // now look for items that are in the EF set of namespaces (ie, csdl/ssdl/msl/edmx namespaces. // If something isn't in this namespace, we return false below (since it won't have a model element) // if something is in this namespace, we'll base this to the base class, which will return true. // // the reason this is here is there will be asserts after undo/redo operations if we can't find // a model element for the xnode that is part of the undo/redo. Returning false from this method // tells us not to expect the model element. // foreach (var v in EntityFrameworkVersion.GetAllVersions()) { foreach (var s in SchemaManager.GetAllNamespacesForVersion(v)) { if (xe.Name.NamespaceName.Equals(s, StringComparison.OrdinalIgnoreCase)) { // we only expect EFObjects for items in the Entity Framework namespaces return(base.ExpectEFObjectForXObject(xobject)); } } } } return(false); }
private bool VerifyUserEdit(XName xn) { if (_namespaces == null) { _namespaces = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var v in EntityFrameworkVersion.GetAllVersions()) { foreach (var s in SchemaManager.GetAllNamespacesForVersion(v)) { _namespaces.Add(s); } } } if (_namespaces.Contains(xn.NamespaceName)) { return(false); } else { return(true); } }