SqlContext
Namespace: PPJ.Runtime.Sql
Assembly: PPJ.Runtime.50 (5.0.0.0)
Provides a scoped set of local and container objects for resolving SQL bind expressions.
- C#
- VB.NET
public class SqlContext : IDisposable
Public Class SqlContext
Inherits IDisposable
Construction pushes a context onto the runtime context stack. Dispose contexts in reverse construction order.
Example:
using PPJ.Runtime.Sql;
var locals = new { CustomerId = 42 };
using (var context = new SqlContext(locals))
{
object currentLocals = SqlContext.Current.Locals;
}
Constructors
SqlContext(locals)
Initializes and pushes a context containing the supplied local and optional container objects.
| Name | Type | Description |
|---|---|---|
| locals | Object | The object exposing local bind variables. |
SqlContext(locals, container)
Initializes and pushes a context containing the supplied local and optional container objects.
| Name | Type | Description |
|---|---|---|
| locals | Object | The object exposing local bind variables. |
| container | Object | The enclosing object used for bind expression resolution. |
Properties
Container
Object: Gets or sets the enclosing object used with the local variables during expression resolution.
Current
SqlContext: Gets the context at the top of the runtime stack, creating an empty context when the stack is empty.
Disposed
Boolean: Gets whether this context has been disposed.
Locals
Object: Gets or sets the local variables object, resolving referenced SQL contexts when necessary.
Methods
Dispose()
Clears local variables and removes the context from the stack when it was pushed.
Calling Dispose more than once throws InvalidOperationException.