private void ParseConceptualModels(XElement conceptualModelsElement) { foreach (var elem in conceptualModelsElement.Elements()) { if (elem.Name.LocalName == BaseEntityModel.ElementName) { if (!CheckForCorrectNamespace(elem, SchemaManager.GetCSDLNamespaceNames())) { continue; } if (_conceptualEntityModel != null) { var msg = String.Format(CultureInfo.CurrentCulture, Resources.DuplicatedElementMsg, elem.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.DUPLICATED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); } else { CreateRuntimeModelRoot(elem); } } else { var msg = String.Format(CultureInfo.CurrentCulture, Resources.UnexpectedElementMsg, elem.Name.LocalName); var error = new ErrorInfo( ErrorInfo.Severity.ERROR, msg, this, ErrorCodes.UNEXPECTED_ELEMENT_ENCOUNTERED, ErrorClass.ParseError); AddParseErrorForObject(this, error); } } }
internal EFRuntimeModelRoot CreateRuntimeModelRoot(XElement runtimeModelRoot) { if (runtimeModelRoot.Name.LocalName == BaseEntityModel.ElementName && CheckForCorrectNamespace(runtimeModelRoot, SchemaManager.GetCSDLNamespaceNames(), false)) { if (_conceptualEntityModel != null) { _conceptualEntityModel.Dispose(); } _conceptualEntityModel = new ConceptualEntityModel(this, runtimeModelRoot); return(_conceptualEntityModel); } else if (runtimeModelRoot.Name.LocalName == BaseEntityModel.ElementName && CheckForCorrectNamespace(runtimeModelRoot, SchemaManager.GetSSDLNamespaceNames(), false)) { if (_storageEntityModel != null) { _storageEntityModel.Dispose(); } _storageEntityModel = new StorageEntityModel(this, runtimeModelRoot); return(_storageEntityModel); } else if (runtimeModelRoot.Name.LocalName == MappingModel.ElementName && CheckForCorrectNamespace(runtimeModelRoot, SchemaManager.GetMSLNamespaceNames(), false)) { if (_mappingModel != null) { _mappingModel.Dispose(); } _mappingModel = new MappingModel(this, runtimeModelRoot); return(_mappingModel); } else { //Debug.Fail("Unexpected runtime model root"); return(null); } }