internal override bool ReparseSingleElement(ICollection <XName> unprocessedElements, XElement element)
        {
            if (element.Name.LocalName == BaseEntityModel.ElementName ||
                element.Name.LocalName == MappingModel.ElementName)
            {
                // Update Model sometimes just replaces the Schema elements; if we undo this, we'll have to
                // parse a new Schema element, so find the entity model that contains it and parse it

                var entityModelXObj = element.Parent;
                Debug.Assert(
                    entityModelXObj != null &&
                    (entityModelXObj.Name.LocalName == "ConceptualModels" || entityModelXObj.Name.LocalName == "StorageModels" ||
                     entityModelXObj.Name.LocalName == "Mappings"),
                    "How could a Schema element be added underneath a parent that is not a ConceptualModel, StorageModel, or Mapping?");

                var conceptualModelsProcessed = false;
                var storageModelsProcessed    = false;
                var mappingsProcessed         = false;

                ParseSingleEntityModelElement(
                    entityModelXObj, ref conceptualModelsProcessed, ref storageModelsProcessed, ref mappingsProcessed);

                if (conceptualModelsProcessed)
                {
                    Debug.Assert(ConceptualModel != null, "If the conceptual model root was created, why isn't it in this artifact?");
                    ConceptualModel.Parse(new List <XName>());
                }
                else if (storageModelsProcessed)
                {
                    Debug.Assert(StorageModel != null, "If the storage model root was created, why isn't it in this artifact?");
                    StorageModel.Parse(new List <XName>());
                }
                else if (mappingsProcessed)
                {
                    Debug.Assert(MappingModel != null, "If the mappings root was created, why isn't it in this artifact?");
                    MappingModel.Parse(new List <XName>());
                }
                return(true);
            }
            else
            {
                return(base.ReparseSingleElement(unprocessedElements, element));
            }
        }
        internal override void Parse(ICollection <XName> unprocessedElements)
        {
            State = EFElementState.ParseAttempted;

            var path      = Uri.LocalPath;
            var lastdot   = path.LastIndexOf('.');
            var extension = Uri.LocalPath.Substring(lastdot, path.Length - lastdot);

            if (extension.EndsWith(ExtensionMsl, StringComparison.OrdinalIgnoreCase))
            {
                _mappingModel = new MappingModel(this, XDocument.Root);
            }
            else if (extension.EndsWith(ExtensionCsdl, StringComparison.OrdinalIgnoreCase))
            {
                _conceptualEntityModel = new ConceptualEntityModel(this, XDocument.Root);
            }
            else if (extension.EndsWith(ExtensionSsdl, StringComparison.OrdinalIgnoreCase))
            {
                _storageEntityModel = new StorageEntityModel(this, XDocument.Root);
            }
            else if (GetFileExtensions().Contains(extension))
            {
                if (_designerInfoRoot != null)
                {
                    _designerInfoRoot.Dispose();
                    _designerInfoRoot = null;
                }

                if (_storageEntityModel != null)
                {
                    _storageEntityModel.Dispose();
                    _storageEntityModel = null;
                }

                if (_mappingModel != null)
                {
                    _mappingModel.Dispose();
                    _mappingModel = null;
                }

                if (_conceptualEntityModel != null)
                {
                    _conceptualEntityModel.Dispose();
                    _conceptualEntityModel = null;
                }

                // convert the xlinq tree to our model
                foreach (var elem in XObject.Document.Elements())
                {
                    ParseSingleElement(unprocessedElements, elem);
                }
            }

            if (_designerInfoRoot != null)
            {
                _designerInfoRoot.Parse(unprocessedElements);
            }

            if (_conceptualEntityModel != null)
            {
                _conceptualEntityModel.Parse(unprocessedElements);
            }

            if (_storageEntityModel != null)
            {
                _storageEntityModel.Parse(unprocessedElements);
            }

            if (_mappingModel != null)
            {
                _mappingModel.Parse(unprocessedElements);
            }

            State = EFElementState.Parsed;
        }