private void Load(XmlReader reader) { Schema schema; IList <EdmSchemaError> edmSchemaErrorList = SchemaManager.LoadProviderManifest(reader, reader.BaseURI.Length > 0 ? reader.BaseURI : (string)null, true, out schema); if (edmSchemaErrorList.Count != 0) { throw new ProviderIncompatibleException(Strings.IncorrectProviderManifest + Helper.CombineErrorMessage((IEnumerable <EdmSchemaError>)edmSchemaErrorList)); } this._namespaceName = schema.Namespace; List <PrimitiveType> primitiveTypeList = new List <PrimitiveType>(); foreach (System.Data.Entity.Core.SchemaObjectModel.SchemaType schemaType in schema.SchemaTypes) { TypeElement typeElement = schemaType as TypeElement; if (typeElement != null) { PrimitiveType primitiveType = typeElement.PrimitiveType; primitiveType.ProviderManifest = (DbProviderManifest)this; primitiveType.DataSpace = DataSpace.SSpace; primitiveType.SetReadOnly(); primitiveTypeList.Add(primitiveType); this._storeTypeNameToStorePrimitiveType.Add(primitiveType.Name.ToLowerInvariant(), primitiveType); this._storeTypeNameToEdmPrimitiveType.Add(primitiveType.Name.ToLowerInvariant(), EdmProviderManifest.Instance.GetPrimitiveType(primitiveType.PrimitiveTypeKind)); ReadOnlyCollection <FacetDescription> collection; if (DbXmlEnabledProviderManifest.EnumerableToReadOnlyCollection <FacetDescription, FacetDescription>(typeElement.FacetDescriptions, out collection)) { this._facetDescriptions.Add(primitiveType, collection); } } } this._primitiveTypes = new ReadOnlyCollection <PrimitiveType>((IList <PrimitiveType>)primitiveTypeList.ToArray()); ItemCollection itemCollection = (ItemCollection) new DbXmlEnabledProviderManifest.EmptyItemCollection(); if (!DbXmlEnabledProviderManifest.EnumerableToReadOnlyCollection <EdmFunction, GlobalItem>(Converter.ConvertSchema(schema, (DbProviderManifest)this, itemCollection), out this._functions)) { this._functions = Helper.EmptyEdmFunctionReadOnlyCollection; } foreach (MetadataItem function in this._functions) { function.SetReadOnly(); } }
/// <summary>Returns the list of facet descriptions for the specified Entity Data Model (EDM) type.</summary> /// <returns> /// A collection of type <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> that contains the list of facet descriptions for the specified EDM type. /// </returns> /// <param name="edmType"> /// An <see cref="T:System.Data.Entity.Core.Metadata.Edm.EdmType" /> for which the facet descriptions are to be retrieved. /// </param> public override ReadOnlyCollection <FacetDescription> GetFacetDescriptions( EdmType edmType) { return(DbXmlEnabledProviderManifest.GetReadOnlyCollection <FacetDescription>(edmType as PrimitiveType, this._facetDescriptions, Helper.EmptyFacetDescriptionEnumerable)); }