Skip to main content

WhenSqlError

Namespace: PPJ.Runtime.Sql

Assembly: PPJ.Runtime.50 (5.0.0.0)

Temporarily suppresses the global SQL error handler on the current thread while a local SQL error block runs.

public class WhenSqlError : IDisposable

Construction increments a thread-local nesting count and disposal decrements it. Dispose each instance exactly once, on the same thread on which it was created. This type does not catch exceptions or implement a local error handler.

Example:

using (new PPJ.Runtime.Sql.WhenSqlError())
{
// Execute SQL operations and apply the translated local error handling here.
}
// Global error handling is available when all nested scopes have ended.

Constructors​

Instance member WhenSqlError()​

Begins a suppression scope by incrementing the current thread's nesting count.

Methods​

Instance member Dispose()​

Ends one suppression scope by decrementing the current thread's nesting count.

This method does not guard against repeated calls; use a single using scope for each instance.