internal void ParseDesignerInfoRoot(XElement designerInfoElement)
 {
     if (_designerInfoRoot != null)
     {
         _designerInfoRoot.Dispose();
     }
     _designerInfoRoot = new EFDesignerInfoRoot(this, designerInfoElement);
     _designerInfoRoot.Parse(new HashSet <XName>());
 }
        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;
        }
Ejemplo n.º 3
0
 internal void ParseDesignerInfoRoot(XElement designerInfoElement)
 {
     if (_designerInfoRoot != null)
     {
         _designerInfoRoot.Dispose();
     }
     _designerInfoRoot = new EFDesignerInfoRoot(this, designerInfoElement);
     _designerInfoRoot.Parse(new HashSet<XName>());
 }