src/EntityFramework.SqlServer/SqlVersionUtils.cs
// <summary>
// Get the SqlVersion from the connection. Returns one of Sql8, Sql9, Sql10, Sql11
// The passed connection must be open
// </summary>
// <param name="connection"> current sql connection </param>
// <returns> Sql Version for the current connection </returns>
Get the SqlVersion from the connection. Returns one of Sql8, Sql9, Sql10, Sql11
The passed connection must be open
Get the SqlVersion from the connection . Returns one of Sql8 Sql9 Sql10 Sql11 The passed connection must be open
internal static SqlVersion GetSqlVersion(DbConnection connection)
        {
            Debug.Assert(connection.State == ConnectionState.Open, "Expected an open connection");
            var majorVersion = Int32.Parse(
                DbInterception.Dispatch.Connection.GetServerVersion(connection, new DbInterceptionContext()).Substring(0, 2),
                CultureInfo.InvariantCulture);
            if (majorVersion >= 11)
            {
                return SqlVersion.Sql11;
            }
            if (majorVersion == 10)
            {
                return SqlVersion.Sql10;
            }
            if (majorVersion == 9)
            {
                return SqlVersion.Sql9;
            }
            Debug.Assert(majorVersion == 8, "not version 8");
            return SqlVersion.Sql8;
        }
internal static SqlVersion GetSqlVersion ( DbConnection connection ) { Debug . Assert ( connection . State == ConnectionState . Open , " " ) ; var majorVersion = Int32 . Parse ( DbInterception . Dispatch . Connection . GetServerVersion ( connection , new DbInterceptionContext ( ) ) . Substring ( 0 , 2 ) , CultureInfo . InvariantCulture ) ; if ( majorVersion >= 11 ) { return SqlVersion . Sql11 ; } if ( majorVersion == 10 ) { return SqlVersion . Sql10 ; } if ( majorVersion == 9 ) { return SqlVersion . Sql9 ; } Debug . Assert ( majorVersion == 8 , " " ) ; return SqlVersion . Sql8 ; }
Get the SqlVersion from the connection.
Get the SqlVersion from the connection .
Sql Version for the current connection
Sql Version for the current connection
connection
DbConnection
current sql connection
current sql connection