/// <summary>
        ///     Adds Store schema resource entries to the given XmlNamespace to XmlSchemaResoure map
        /// </summary>
        /// <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddStoreSchemaResourceMapEntries(Dictionary <string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            XmlSchemaResource[] ssdlImports =
            {
                new XmlSchemaResource(
                    XmlConstants.EntityStoreSchemaGeneratorNamespace,
                    "System.Data.Resources.EntityStoreSchemaGenerator.xsd")
            };

            var ssdlSchema = new XmlSchemaResource(XmlConstants.TargetNamespace_1, "System.Data.Resources.SSDLSchema.xsd", ssdlImports);

            schemaResourceMap.Add(ssdlSchema.NamespaceUri, ssdlSchema);

            if (schemaVersion >= XmlConstants.StoreVersionForV2)
            {
                var ssdlSchema2 = new XmlSchemaResource(
                    XmlConstants.TargetNamespace_2, "System.Data.Resources.SSDLSchema_2.xsd", ssdlImports);
                schemaResourceMap.Add(ssdlSchema2.NamespaceUri, ssdlSchema2);
            }

            if (schemaVersion >= XmlConstants.StoreVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.StoreVersionForV3, "Did you add a new schema version");

                var ssdlSchema3 = new XmlSchemaResource(
                    XmlConstants.TargetNamespace_3, "System.Data.Resources.SSDLSchema_3.xsd", ssdlImports);
                schemaResourceMap.Add(ssdlSchema3.NamespaceUri, ssdlSchema3);
            }

            var providerManifest = new XmlSchemaResource(
                XmlConstants.ProviderManifestNamespace, "System.Data.Resources.ProviderServices.ProviderManifest.xsd");

            schemaResourceMap.Add(providerManifest.NamespaceUri, providerManifest);
        }
Exemple #2
0
        public bool IsValidateableXmlNamespace(string xmlNamespaceUri, bool isAttribute)
        {
            if (string.IsNullOrEmpty(xmlNamespaceUri) && isAttribute)
            {
                // we own the empty namespace for attributes
                return(true);
            }

            if (_validatableXmlNamespaces == null)
            {
                var validatableXmlNamespaces = new HashSet <string>();
                var schemaVersion            = SchemaVersion == XmlConstants.UndefinedVersion ? XmlConstants.SchemaVersionLatest : SchemaVersion;
                foreach (var schemaResource in XmlSchemaResource.GetMetadataSchemaResourceMap(schemaVersion).Values)
                {
                    AddAllSchemaResourceNamespaceNames(validatableXmlNamespaces, schemaResource);
                }

                if (SchemaVersion == XmlConstants.UndefinedVersion)
                {
                    // we are getting called before the version is set
                    return(validatableXmlNamespaces.Contains(xmlNamespaceUri));
                }
                _validatableXmlNamespaces = validatableXmlNamespaces;
            }

            return(_validatableXmlNamespaces.Contains(xmlNamespaceUri));
        }
Exemple #3
0
        internal static void AddStoreSchemaResourceMapEntries(
            Dictionary <string, XmlSchemaResource> schemaResourceMap,
            double schemaVersion)
        {
            XmlSchemaResource[] importedSchemas = new XmlSchemaResource[1]
            {
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator", "System.Data.Resources.EntityStoreSchemaGenerator.xsd")
            };
            XmlSchemaResource xmlSchemaResource1 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/edm/ssdl", "System.Data.Resources.SSDLSchema.xsd", importedSchemas);

            schemaResourceMap.Add(xmlSchemaResource1.NamespaceUri, xmlSchemaResource1);
            if (schemaVersion >= 2.0)
            {
                XmlSchemaResource xmlSchemaResource2 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/02/edm/ssdl", "System.Data.Resources.SSDLSchema_2.xsd", importedSchemas);
                schemaResourceMap.Add(xmlSchemaResource2.NamespaceUri, xmlSchemaResource2);
            }
            if (schemaVersion >= 3.0)
            {
                XmlSchemaResource xmlSchemaResource2 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/11/edm/ssdl", "System.Data.Resources.SSDLSchema_3.xsd", importedSchemas);
                schemaResourceMap.Add(xmlSchemaResource2.NamespaceUri, xmlSchemaResource2);
            }
            XmlSchemaResource xmlSchemaResource3 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/edm/providermanifest", "System.Data.Resources.ProviderServices.ProviderManifest.xsd");

            schemaResourceMap.Add(xmlSchemaResource3.NamespaceUri, xmlSchemaResource3);
        }
        // <summary>
        // Adds Store schema resource entries to the given XmlNamespace to XmlSchemaResoure map
        // </summary>
        // <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddStoreSchemaResourceMapEntries(Dictionary<string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            XmlSchemaResource[] ssdlImports =
                {
                    new XmlSchemaResource(
                        XmlConstants.EntityStoreSchemaGeneratorNamespace,
                        "System.Data.Resources.EntityStoreSchemaGenerator.xsd")
                };

            var ssdlSchema = new XmlSchemaResource(XmlConstants.TargetNamespace_1, "System.Data.Resources.SSDLSchema.xsd", ssdlImports);
            schemaResourceMap.Add(ssdlSchema.NamespaceUri, ssdlSchema);

            if (schemaVersion >= XmlConstants.StoreVersionForV2)
            {
                var ssdlSchema2 = new XmlSchemaResource(
                    XmlConstants.TargetNamespace_2, "System.Data.Resources.SSDLSchema_2.xsd", ssdlImports);
                schemaResourceMap.Add(ssdlSchema2.NamespaceUri, ssdlSchema2);
            }

            if (schemaVersion >= XmlConstants.StoreVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.StoreVersionForV3, "Did you add a new schema version");

                var ssdlSchema3 = new XmlSchemaResource(
                    XmlConstants.TargetNamespace_3, "System.Data.Resources.SSDLSchema_3.xsd", ssdlImports);
                schemaResourceMap.Add(ssdlSchema3.NamespaceUri, ssdlSchema3);
            }

            var providerManifest = new XmlSchemaResource(
                XmlConstants.ProviderManifestNamespace, "System.Data.Resources.ProviderServices.ProviderManifest.xsd");
            schemaResourceMap.Add(providerManifest.NamespaceUri, providerManifest);
        }
 public XmlSchemaResource(string namespaceUri, string resourceName, XmlSchemaResource[] importedSchemas)
 {
     DebugCheck.NotEmpty(namespaceUri);
     DebugCheck.NotEmpty(resourceName);
     DebugCheck.NotNull(importedSchemas);
     NamespaceUri = namespaceUri;
     ResourceName = resourceName;
     ImportedSchemas = importedSchemas;
 }
Exemple #6
0
        internal static Dictionary <string, XmlSchemaResource> GetMetadataSchemaResourceMap(
            double schemaVersion)
        {
            Dictionary <string, XmlSchemaResource> schemaResourceMap = new Dictionary <string, XmlSchemaResource>((IEqualityComparer <string>)StringComparer.Ordinal);

            XmlSchemaResource.AddEdmSchemaResourceMapEntries(schemaResourceMap, schemaVersion);
            XmlSchemaResource.AddStoreSchemaResourceMapEntries(schemaResourceMap, schemaVersion);
            return(schemaResourceMap);
        }
Exemple #7
0
 private static void AddAllSchemaResourceNamespaceNames(
     HashSet <string> hashSet,
     XmlSchemaResource schemaResource)
 {
     hashSet.Add(schemaResource.NamespaceUri);
     foreach (XmlSchemaResource importedSchema in schemaResource.ImportedSchemas)
     {
         System.Data.Entity.Core.SchemaObjectModel.Schema.AddAllSchemaResourceNamespaceNames(hashSet, importedSchema);
     }
 }
        /// <summary>
        ///     Adds Edm schema resource entries to the given XmlNamespace to XmlSchemaResoure map,
        ///     when calling from SomSchemaSetHelper.ComputeSchemaSet(), all the imported xsd will be included
        /// </summary>
        /// <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddEdmSchemaResourceMapEntries(Dictionary <string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            XmlSchemaResource[] csdlImports =
            {
                new XmlSchemaResource(
                    XmlConstants.CodeGenerationSchemaNamespace,
                    "System.Data.Resources.CodeGenerationSchema.xsd")
            };

            XmlSchemaResource[] csdl2Imports =
            {
                new XmlSchemaResource(
                    XmlConstants.CodeGenerationSchemaNamespace,
                    "System.Data.Resources.CodeGenerationSchema.xsd"),
                new XmlSchemaResource(
                    XmlConstants.AnnotationNamespace, "System.Data.Resources.AnnotationSchema.xsd")
            };

            XmlSchemaResource[] csdl3Imports =
            {
                new XmlSchemaResource(
                    XmlConstants.CodeGenerationSchemaNamespace,
                    "System.Data.Resources.CodeGenerationSchema.xsd"),
                new XmlSchemaResource(
                    XmlConstants.AnnotationNamespace, "System.Data.Resources.AnnotationSchema.xsd")
            };

            var csdlSchema_1 = new XmlSchemaResource(XmlConstants.ModelNamespace_1, "System.Data.Resources.CSDLSchema_1.xsd", csdlImports);

            schemaResourceMap.Add(csdlSchema_1.NamespaceUri, csdlSchema_1);

            var csdlSchema_1_1 = new XmlSchemaResource(
                XmlConstants.ModelNamespace_1_1, "System.Data.Resources.CSDLSchema_1_1.xsd", csdlImports);

            schemaResourceMap.Add(csdlSchema_1_1.NamespaceUri, csdlSchema_1_1);

            if (schemaVersion >= XmlConstants.EdmVersionForV2)
            {
                var csdlSchema_2 = new XmlSchemaResource(
                    XmlConstants.ModelNamespace_2, "System.Data.Resources.CSDLSchema_2.xsd", csdl2Imports);
                schemaResourceMap.Add(csdlSchema_2.NamespaceUri, csdlSchema_2);
            }

            if (schemaVersion >= XmlConstants.EdmVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.EdmVersionForV3, "Did you add a new schema version");

                var csdlSchema_3 = new XmlSchemaResource(
                    XmlConstants.ModelNamespace_3, "System.Data.Resources.CSDLSchema_3.xsd", csdl3Imports);
                schemaResourceMap.Add(csdlSchema_3.NamespaceUri, csdlSchema_3);
            }
        }
Exemple #9
0
 public bool IsParseableXmlNamespace(string xmlNamespaceUri, bool isAttribute)
 {
     if (string.IsNullOrEmpty(xmlNamespaceUri) && isAttribute)
     {
         return(true);
     }
     if (this._parseableXmlNamespaces == null)
     {
         this._parseableXmlNamespaces = new HashSet <string>();
         foreach (XmlSchemaResource xmlSchemaResource in XmlSchemaResource.GetMetadataSchemaResourceMap(this.SchemaVersion).Values)
         {
             this._parseableXmlNamespaces.Add(xmlSchemaResource.NamespaceUri);
         }
     }
     return(this._parseableXmlNamespaces.Contains(xmlNamespaceUri));
 }
Exemple #10
0
            private static void AddXmlSchemaToSet(
                XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet <string> schemasAlreadyAdded)
            {
                // loop through the children to do a depth first load
                foreach (var import in schemaResource.ImportedSchemas)
                {
                    AddXmlSchemaToSet(schemaSet, import, schemasAlreadyAdded);
                }

                if (!schemasAlreadyAdded.Contains(schemaResource.NamespaceUri))
                {
                    var xsdStream = GetResourceStream(schemaResource.ResourceName);
                    var schema    = XmlSchema.Read(xsdStream, null);
                    schemaSet.Add(schema);
                    schemasAlreadyAdded.Add(schemaResource.NamespaceUri);
                }
            }
Exemple #11
0
            private static XmlSchemaSet ComputeSchemaSet(SchemaDataModelOption dataModel)
            {
                List <string> schemaNamespaces = System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.GetPrimarySchemaNamespaces(dataModel);
                XmlSchemaSet  schemaSet        = new XmlSchemaSet();

                schemaSet.XmlResolver = (XmlResolver)null;
                Dictionary <string, XmlSchemaResource> schemaResourceMap = XmlSchemaResource.GetMetadataSchemaResourceMap(3.0);
                HashSet <string> schemasAlreadyAdded = new HashSet <string>();

                foreach (string index in schemaNamespaces)
                {
                    XmlSchemaResource schemaResource = schemaResourceMap[index];
                    System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(schemaSet, schemaResource, schemasAlreadyAdded);
                }
                schemaSet.Compile();
                return(schemaSet);
            }
Exemple #12
0
            private static void AddXmlSchemaToSet(
                XmlSchemaSet schemaSet,
                XmlSchemaResource schemaResource,
                HashSet <string> schemasAlreadyAdded)
            {
                foreach (XmlSchemaResource importedSchema in schemaResource.ImportedSchemas)
                {
                    System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(schemaSet, importedSchema, schemasAlreadyAdded);
                }
                if (schemasAlreadyAdded.Contains(schemaResource.NamespaceUri))
                {
                    return;
                }
                XmlSchema schema = XmlSchema.Read(System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.GetResourceStream(schemaResource.ResourceName), (ValidationEventHandler)null);

                schemaSet.Add(schema);
                schemasAlreadyAdded.Add(schemaResource.NamespaceUri);
            }
Exemple #13
0
        public bool IsParseableXmlNamespace(string xmlNamespaceUri, bool isAttribute)
        {
            if (string.IsNullOrEmpty(xmlNamespaceUri) && isAttribute)
            {
                // we own the empty namespace for attributes
                return(true);
            }

            if (_parseableXmlNamespaces == null)
            {
                _parseableXmlNamespaces = new HashSet <string>();
                foreach (var schemaResource in XmlSchemaResource.GetMetadataSchemaResourceMap(SchemaVersion).Values)
                {
                    _parseableXmlNamespaces.Add(schemaResource.NamespaceUri);
                }
            }

            return(_parseableXmlNamespaces.Contains(xmlNamespaceUri));
        }
Exemple #14
0
        internal static void AddMappingSchemaResourceMapEntries(
            Dictionary <string, XmlSchemaResource> schemaResourceMap,
            double schemaVersion)
        {
            XmlSchemaResource xmlSchemaResource1 = new XmlSchemaResource("urn:schemas-microsoft-com:windows:storage:mapping:CS", "System.Data.Resources.CSMSL_1.xsd");

            schemaResourceMap.Add(xmlSchemaResource1.NamespaceUri, xmlSchemaResource1);
            if (schemaVersion >= 2.0)
            {
                XmlSchemaResource xmlSchemaResource2 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2008/09/mapping/cs", "System.Data.Resources.CSMSL_2.xsd");
                schemaResourceMap.Add(xmlSchemaResource2.NamespaceUri, xmlSchemaResource2);
            }
            if (schemaVersion < 3.0)
            {
                return;
            }
            XmlSchemaResource xmlSchemaResource3 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/11/mapping/cs", "System.Data.Resources.CSMSL_3.xsd");

            schemaResourceMap.Add(xmlSchemaResource3.NamespaceUri, xmlSchemaResource3);
        }
        /// <summary>
        ///     Adds Mapping schema resource entries to the given XmlNamespace to XmlSchemaResoure map
        /// </summary>
        /// <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddMappingSchemaResourceMapEntries(
            Dictionary <string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            var msl1 = new XmlSchemaResource(StorageMslConstructs.NamespaceUriV1, StorageMslConstructs.ResourceXsdNameV1);

            schemaResourceMap.Add(msl1.NamespaceUri, msl1);

            if (schemaVersion >= XmlConstants.EdmVersionForV2)
            {
                var msl2 = new XmlSchemaResource(StorageMslConstructs.NamespaceUriV2, StorageMslConstructs.ResourceXsdNameV2);
                schemaResourceMap.Add(msl2.NamespaceUri, msl2);
            }

            if (schemaVersion >= XmlConstants.EdmVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.EdmVersionForV3, "Did you add a new schema version");
                var msl3 = new XmlSchemaResource(StorageMslConstructs.NamespaceUriV3, StorageMslConstructs.ResourceXsdNameV3);
                schemaResourceMap.Add(msl3.NamespaceUri, msl3);
            }
        }
Exemple #16
0
 public bool IsValidateableXmlNamespace(string xmlNamespaceUri, bool isAttribute)
 {
     if (string.IsNullOrEmpty(xmlNamespaceUri) && isAttribute)
     {
         return(true);
     }
     if (this._validatableXmlNamespaces == null)
     {
         HashSet <string> hashSet = new HashSet <string>();
         foreach (XmlSchemaResource schemaResource in XmlSchemaResource.GetMetadataSchemaResourceMap(this.SchemaVersion == 0.0 ? 3.0 : this.SchemaVersion).Values)
         {
             System.Data.Entity.Core.SchemaObjectModel.Schema.AddAllSchemaResourceNamespaceNames(hashSet, schemaResource);
         }
         if (this.SchemaVersion == 0.0)
         {
             return(hashSet.Contains(xmlNamespaceUri));
         }
         this._validatableXmlNamespaces = hashSet;
     }
     return(this._validatableXmlNamespaces.Contains(xmlNamespaceUri));
 }
Exemple #17
0
        internal static void AddEdmSchemaResourceMapEntries(
            Dictionary <string, XmlSchemaResource> schemaResourceMap,
            double schemaVersion)
        {
            XmlSchemaResource[] importedSchemas1 = new XmlSchemaResource[1]
            {
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/codegeneration", "System.Data.Resources.CodeGenerationSchema.xsd")
            };
            XmlSchemaResource[] importedSchemas2 = new XmlSchemaResource[2]
            {
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/codegeneration", "System.Data.Resources.CodeGenerationSchema.xsd"),
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/02/edm/annotation", "System.Data.Resources.AnnotationSchema.xsd")
            };
            XmlSchemaResource[] importedSchemas3 = new XmlSchemaResource[2]
            {
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/codegeneration", "System.Data.Resources.CodeGenerationSchema.xsd"),
                new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/02/edm/annotation", "System.Data.Resources.AnnotationSchema.xsd")
            };
            XmlSchemaResource xmlSchemaResource1 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2006/04/edm", "System.Data.Resources.CSDLSchema_1.xsd", importedSchemas1);

            schemaResourceMap.Add(xmlSchemaResource1.NamespaceUri, xmlSchemaResource1);
            XmlSchemaResource xmlSchemaResource2 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2007/05/edm", "System.Data.Resources.CSDLSchema_1_1.xsd", importedSchemas1);

            schemaResourceMap.Add(xmlSchemaResource2.NamespaceUri, xmlSchemaResource2);
            if (schemaVersion >= 2.0)
            {
                XmlSchemaResource xmlSchemaResource3 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2008/09/edm", "System.Data.Resources.CSDLSchema_2.xsd", importedSchemas2);
                schemaResourceMap.Add(xmlSchemaResource3.NamespaceUri, xmlSchemaResource3);
            }
            if (schemaVersion < 3.0)
            {
                return;
            }
            XmlSchemaResource xmlSchemaResource4 = new XmlSchemaResource("http://schemas.microsoft.com/ado/2009/11/edm", "System.Data.Resources.CSDLSchema_3.xsd", importedSchemas3);

            schemaResourceMap.Add(xmlSchemaResource4.NamespaceUri, xmlSchemaResource4);
        }
Exemple #18
0
            private static XmlSchemaSet ComputeSchemaSet(SchemaDataModelOption dataModel)
            {
                var namespaceNames = GetPrimarySchemaNamespaces(dataModel);

                Debug.Assert(namespaceNames.Count > 0, "Unknown Datamodel");

                var schemaSet = new XmlSchemaSet();

                // remove the default XmlResolver which will look on
                // disk for the referenced schemas that we already provided
                schemaSet.XmlResolver = null;
                var schemaResourceMap   = XmlSchemaResource.GetMetadataSchemaResourceMap(XmlConstants.SchemaVersionLatest);
                var schemasAlreadyAdded = new HashSet <string>();

                foreach (var namespaceName in namespaceNames)
                {
                    Debug.Assert(schemaResourceMap.ContainsKey(namespaceName), "the namespace name is not one we have a schema set for");
                    var schemaResource = schemaResourceMap[namespaceName];
                    AddXmlSchemaToSet(schemaSet, schemaResource, schemasAlreadyAdded);
                }
                schemaSet.Compile();

                return(schemaSet);
            }
Exemple #19
0
            private static void AddXmlSchemaToSet(
                XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet<string> schemasAlreadyAdded)
            {
                // loop through the children to do a depth first load
                foreach (var import in schemaResource.ImportedSchemas)
                {
                    AddXmlSchemaToSet(schemaSet, import, schemasAlreadyAdded);
                }

                if (!schemasAlreadyAdded.Contains(schemaResource.NamespaceUri))
                {
                    var xsdStream = GetResourceStream(schemaResource.ResourceName);
                    var schema = XmlSchema.Read(xsdStream, null);
                    schemaSet.Add(schema);
                    schemasAlreadyAdded.Add(schemaResource.NamespaceUri);
                }
            }
        // <summary>
        // Adds Edm schema resource entries to the given XmlNamespace to XmlSchemaResoure map,
        // when calling from SomSchemaSetHelper.ComputeSchemaSet(), all the imported xsd will be included
        // </summary>
        // <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddEdmSchemaResourceMapEntries(Dictionary<string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            XmlSchemaResource[] csdlImports =
                {
                    new XmlSchemaResource(
                        XmlConstants.CodeGenerationSchemaNamespace,
                        "System.Data.Resources.CodeGenerationSchema.xsd")
                };

            XmlSchemaResource[] csdl2Imports =
                {
                    new XmlSchemaResource(
                        XmlConstants.CodeGenerationSchemaNamespace,
                        "System.Data.Resources.CodeGenerationSchema.xsd"),
                    new XmlSchemaResource(
                        XmlConstants.AnnotationNamespace, "System.Data.Resources.AnnotationSchema.xsd")
                };

            XmlSchemaResource[] csdl3Imports =
                {
                    new XmlSchemaResource(
                        XmlConstants.CodeGenerationSchemaNamespace,
                        "System.Data.Resources.CodeGenerationSchema.xsd"),
                    new XmlSchemaResource(
                        XmlConstants.AnnotationNamespace, "System.Data.Resources.AnnotationSchema.xsd")
                };

            var csdlSchema_1 = new XmlSchemaResource(XmlConstants.ModelNamespace_1, "System.Data.Resources.CSDLSchema_1.xsd", csdlImports);
            schemaResourceMap.Add(csdlSchema_1.NamespaceUri, csdlSchema_1);

            var csdlSchema_1_1 = new XmlSchemaResource(
                XmlConstants.ModelNamespace_1_1, "System.Data.Resources.CSDLSchema_1_1.xsd", csdlImports);
            schemaResourceMap.Add(csdlSchema_1_1.NamespaceUri, csdlSchema_1_1);

            if (schemaVersion >= XmlConstants.EdmVersionForV2)
            {
                var csdlSchema_2 = new XmlSchemaResource(
                    XmlConstants.ModelNamespace_2, "System.Data.Resources.CSDLSchema_2.xsd", csdl2Imports);
                schemaResourceMap.Add(csdlSchema_2.NamespaceUri, csdlSchema_2);
            }

            if (schemaVersion >= XmlConstants.EdmVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.EdmVersionForV3, "Did you add a new schema version");

                var csdlSchema_3 = new XmlSchemaResource(
                    XmlConstants.ModelNamespace_3, "System.Data.Resources.CSDLSchema_3.xsd", csdl3Imports);
                schemaResourceMap.Add(csdlSchema_3.NamespaceUri, csdlSchema_3);
            }
        }
Exemple #21
0
 private static void AddAllSchemaResourceNamespaceNames(HashSet <string> hashSet, XmlSchemaResource schemaResource)
 {
     hashSet.Add(schemaResource.NamespaceUri);
     foreach (var import in schemaResource.ImportedSchemas)
     {
         AddAllSchemaResourceNamespaceNames(hashSet, import);
     }
 }
        // <summary>
        // Adds Mapping schema resource entries to the given XmlNamespace to XmlSchemaResoure map
        // </summary>
        // <param name="schemaResourceMap"> The XmlNamespace to XmlSchemaResource map to add entries to. </param>
        internal static void AddMappingSchemaResourceMapEntries(
            Dictionary<string, XmlSchemaResource> schemaResourceMap, double schemaVersion)
        {
            var msl1 = new XmlSchemaResource(MslConstructs.NamespaceUriV1, MslConstructs.ResourceXsdNameV1);
            schemaResourceMap.Add(msl1.NamespaceUri, msl1);

            if (schemaVersion >= XmlConstants.EdmVersionForV2)
            {
                var msl2 = new XmlSchemaResource(MslConstructs.NamespaceUriV2, MslConstructs.ResourceXsdNameV2);
                schemaResourceMap.Add(msl2.NamespaceUri, msl2);
            }

            if (schemaVersion >= XmlConstants.EdmVersionForV3)
            {
                Debug.Assert(XmlConstants.SchemaVersionLatest == XmlConstants.EdmVersionForV3, "Did you add a new schema version");
                var msl3 = new XmlSchemaResource(MslConstructs.NamespaceUriV3, MslConstructs.ResourceXsdNameV3);
                schemaResourceMap.Add(msl3.NamespaceUri, msl3);
            }
        }
Exemple #23
0
 private static void AddAllSchemaResourceNamespaceNames(HashSet<string> hashSet, XmlSchemaResource schemaResource)
 {
     hashSet.Add(schemaResource.NamespaceUri);
     foreach (var import in schemaResource.ImportedSchemas)
     {
         AddAllSchemaResourceNamespaceNames(hashSet, import);
     }
 }