Exemple #1
0
        private void WriteSchemaElement(string schemaNamespace, string provider, string providerManifestToken, params KeyValuePair <string, string>[] xmlPrefixToNamespaces)
        {
            string xmlNamespace = EntityFrameworkVersions.GetSchemaNamespace(_schemaVersion, _isModel ? DataSpace.CSpace : DataSpace.SSpace);

            _writer.WriteStartElement(XmlConstants.Schema, xmlNamespace);
            _writer.WriteAttributeString(XmlConstants.Namespace, schemaNamespace);
            _writer.WriteAttributeString(XmlConstants.Alias, "Self");
            if (_isModel && _schemaVersion >= EntityFrameworkVersions.Version3)
            {
                _writer.WriteAttributeString(XmlConstants.UseStrongSpatialTypes, XmlConstants.AnnotationNamespace, XmlConstants.False);
            }
            if (!_isModel)
            {
                if (!string.IsNullOrEmpty(provider))
                {
                    _writer.WriteAttributeString(XmlConstants.Provider, provider);
                }

                if (!string.IsNullOrEmpty(providerManifestToken))
                {
                    _writer.WriteAttributeString(XmlConstants.ProviderManifestToken, providerManifestToken);
                }
            }

            // write out the extra xml namespaces and their pretty prefix
            foreach (KeyValuePair <string, string> xmlPrefixToNamespace in xmlPrefixToNamespaces)
            {
                // see http://www.w3.org/TR/2006/REC-xml-names-20060816/
                _writer.WriteAttributeString("xmlns", xmlPrefixToNamespace.Key, null, xmlPrefixToNamespace.Value);
            }
        }
Exemple #2
0
 internal static void CheckTargetEntityFrameworkVersionArgument(Version targetEntityFrameworkVersion, string parameterName)
 {
     EDesignUtil.CheckArgumentNull(targetEntityFrameworkVersion, parameterName);
     if (!EntityFrameworkVersions.IsValidVersion(targetEntityFrameworkVersion))
     {
         throw EDesignUtil.Argument(parameterName);
     }
 }
 internal OneToOneMappingSerializer(MappingLookups lookups,
                                    EntityContainer storeContainer,
                                    EntityContainer modelContainer,
                                    Version schemaVersion)
 {
     EDesignUtil.CheckArgumentNull(lookups, "lookups");
     EDesignUtil.CheckArgumentNull(storeContainer, "storeContainer");
     EDesignUtil.CheckArgumentNull(modelContainer, "modelContainer");
     _lookups        = lookups;
     _storeContainer = storeContainer;
     _modelContainer = modelContainer;
     _xmlNamespace   = EntityFrameworkVersions.GetSchemaNamespace(schemaVersion, DataSpace.CSSpace);
 }