private MetadataConverterHandler CreateConverterHandler(Version sourceSchemaVersion, Version targetSchemaVersion)
        {
            if (this == _instance)
            {
                var namespaceConverter             = new NamespaceConverterHandler(sourceSchemaVersion, targetSchemaVersion);
                var versionConverter               = new VersionConverterHandler(targetSchemaVersion);
                var useStrongSpatialTypesConverter = new UseStrongSpatialTypesHandler(targetSchemaVersion);

                namespaceConverter.SetNextHandler(versionConverter);
                versionConverter.SetNextHandler(useStrongSpatialTypesConverter);
                return(namespaceConverter);
            }

            return(null);
        }
        public void HandleConversion_Targeting_EntityFramework_V1_Removes_UseStrongSpatialTypes_Attribute()
        {
            var inputDoc  = LoadEdmx(V1EdmxWithUseStrongSpatialTypes);
            var handler   = new UseStrongSpatialTypesHandler(EntityFrameworkVersion.Version1);
            var resultDoc = handler.HandleConversion(inputDoc);
            var nsmgr     = SchemaManager.GetEdmxNamespaceManager(resultDoc.NameTable, EntityFrameworkVersion.Version1);

            nsmgr.AddNamespace("annotation", SchemaManager.GetAnnotationNamespaceName());
            var useStrongSpatialTypeAttr =
                (XmlAttribute)
                resultDoc.SelectSingleNode(
                    "/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema/@annotation:UseStrongSpatialTypes", nsmgr);

            Assert.Null(useStrongSpatialTypeAttr);
        }
        public void HandleConversion_Targeting_EntityFramework_V3_Inserts_UseStrongSpatialTypes_Attribute()
        {
            var inputDoc  = LoadEdmx(V3EdmxWithoutUseStrongSpatialTypes);
            var handler   = new UseStrongSpatialTypesHandler(EntityFrameworkVersion.Version3);
            var resultDoc = handler.HandleConversion(inputDoc);
            var nsmgr     = SchemaManager.GetEdmxNamespaceManager(resultDoc.NameTable, EntityFrameworkVersion.Version3);

            nsmgr.AddNamespace("annotation", SchemaManager.GetAnnotationNamespaceName());

            var schemaElement = (XmlElement)resultDoc.SelectSingleNode("/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema", nsmgr);

            Assert.NotNull(schemaElement.Attributes["annotation", "http://www.w3.org/2000/xmlns/"]);
            var useStrongSpatialTypeAttr =
                (XmlAttribute)
                resultDoc.SelectSingleNode(
                    "/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema/@annotation:UseStrongSpatialTypes", nsmgr);

            Assert.Equal("false", useStrongSpatialTypeAttr.Value);
        }
 public void HandleConversion_Targeting_EntityFramework_V1_Removes_UseStrongSpatialTypes_Attribute()
 {
     var inputDoc = LoadEdmx(V1EdmxWithUseStrongSpatialTypes);
     var handler = new UseStrongSpatialTypesHandler(EntityFrameworkVersion.Version1);
     var resultDoc = handler.HandleConversion(inputDoc);
     var nsmgr = SchemaManager.GetEdmxNamespaceManager(resultDoc.NameTable, EntityFrameworkVersion.Version1);
     nsmgr.AddNamespace("annotation", SchemaManager.GetAnnotationNamespaceName());
     var useStrongSpatialTypeAttr =
         (XmlAttribute)
         resultDoc.SelectSingleNode(
             "/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema/@annotation:UseStrongSpatialTypes", nsmgr);
     Assert.Null(useStrongSpatialTypeAttr);
 }
        public void HandleConversion_Targeting_EntityFramework_V3_Inserts_UseStrongSpatialTypes_Attribute()
        {
            var inputDoc = LoadEdmx(V3EdmxWithoutUseStrongSpatialTypes);
            var handler = new UseStrongSpatialTypesHandler(EntityFrameworkVersion.Version3);
            var resultDoc = handler.HandleConversion(inputDoc);
            var nsmgr = SchemaManager.GetEdmxNamespaceManager(resultDoc.NameTable, EntityFrameworkVersion.Version3);
            nsmgr.AddNamespace("annotation", SchemaManager.GetAnnotationNamespaceName());

            var schemaElement = (XmlElement)resultDoc.SelectSingleNode("/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema", nsmgr);
            Assert.NotNull(schemaElement.Attributes["annotation", "http://www.w3.org/2000/xmlns/"]);
            var useStrongSpatialTypeAttr =
                (XmlAttribute)
                resultDoc.SelectSingleNode(
                    "/edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/csdl:Schema/@annotation:UseStrongSpatialTypes", nsmgr);
            Assert.Equal("false", useStrongSpatialTypeAttr.Value);
        }
        private MetadataConverterHandler CreateConverterHandler(Version sourceSchemaVersion, Version targetSchemaVersion)
        {
            if (this == _instance)
            {
                var namespaceConverter = new NamespaceConverterHandler(sourceSchemaVersion, targetSchemaVersion);
                var versionConverter = new VersionConverterHandler(targetSchemaVersion);
                var useStrongSpatialTypesConverter = new UseStrongSpatialTypesHandler(targetSchemaVersion);

                namespaceConverter.SetNextHandler(versionConverter);
                versionConverter.SetNextHandler(useStrongSpatialTypesConverter);
                return namespaceConverter;
            }

            return null;
        }