Esempio n. 1
0
        /// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommandBuilder.xml' path='docs/members[@name="SqlCommandBuilder"]/GetSchemaTable/*'/>
        protected override DataTable GetSchemaTable(DbCommand srcCommand)
        {
            SqlCommand             sqlCommand          = srcCommand as SqlCommand;
            SqlNotificationRequest notificationRequest = sqlCommand.Notification;

            sqlCommand.Notification = null;

            try
            {
                using (SqlDataReader dataReader = sqlCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo))
                {
                    return(dataReader.GetSchemaTable());
                }
            }
            finally
            {
                sqlCommand.Notification = notificationRequest;
            }
        }
Esempio n. 2
0
        /// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlCommandBuilder.xml' path='docs/members[@name="SqlCommandBuilder"]/GetSchemaTable/*'/>
        protected override DataTable GetSchemaTable(DbCommand srcCommand)
        {
            SqlCommand             sqlCommand          = srcCommand as SqlCommand;
            SqlNotificationRequest notificationRequest = sqlCommand.Notification;

            sqlCommand.Notification = null;
#if NETFRAMEWORK
            bool notificationAutoEnlist = sqlCommand.NotificationAutoEnlist;
            sqlCommand.NotificationAutoEnlist = false;
#endif

            try
            {
                using SqlDataReader dataReader = sqlCommand.ExecuteReader(CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
                return(dataReader.GetSchemaTable());
            }
            finally
            {
                sqlCommand.Notification = notificationRequest;
#if NETFRAMEWORK
                sqlCommand.NotificationAutoEnlist = notificationAutoEnlist;
#endif
            }
        }