ConnectionExtensions class

namespace: Serenity.Data   assemblySerenity.Net.Data

Contains DB connection related extensions

public static class ConnectionExtensions

Public Members

name description
const DefaultConnectionKey Default connection key, this is an optional name
static EnsureOpen(…) Ensures the connection is open. Warning! This method will not reopen a connection that once was opened and will raise an error.
static GetCurrentActualTransaction(…) Gets the current actual transaction for a connection if any. Most of the time, a connection will only have one transaction, but in .NET it is not possible to know what is that transaction. Serenity wraps a connection (WrappedConnection) so that running transaction if any is available to get from the connection object.
static GetDialect(…) Gets the dialect for given connection.
static GetLogger(…) Gets the logger for a connection if it implements IHasLogger interface, or null if not.
static NewFor<TClass>(…) Creates a new connection for specified class, determining the connection key by checking its [ConnectionKey] attribute.
static SetCommandTimeout(…) Sets the default command timeout for given connection. Only works with IHasCommandTimeout (WrappedConnection) instances, which are usually created by SqlConnections.NewXyz methods.

See Also