コード例 #1
0
        /// <summary>
        ///     Gets the <see cref = "MetadataWorkspace" />.
        ///     If the workspace is not compatible with the provider manifest obtained from the given
        ///     connection then an exception is thrown.
        /// </summary>
        /// <param name = "storeConnection">The connection to use to create or check SSDL provider info.</param>
        /// <returns>The workspace.</returns>
        public MetadataWorkspace GetMetadataWorkspace(DbConnection connection)
        {
            var providerInvariantName = connection.GetProviderInvariantName();

            if (!string.Equals(_providerInfo.ProviderInvariantName, providerInvariantName, StringComparison.Ordinal))
            {
                throw Error.CodeFirstCachedMetadataWorkspace_SameModelDifferentProvidersNotSupported();
            }

            return _metadataWorkspace;
        }