Skip to content

ConnectionExtensions class

namespace: Serenity.Data   assemblySerenity.Net.Services

Contains DB connection related extensions.

public static class ConnectionExtensions

Public Members

name description
const DefaultConnectionKey The default connection key, which is an optional name.
static EnsureOpen(…) Ensures the connection is open. Warning! This method will not reopen a connection that was once opened and will raise an error.
static EnsureOpenAsync(…) Ensures the connection is open asynchronously. Warning! This method will not reopen a connection that was once 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 that transaction is. Serenity wraps a connection (WrappedConnection) so that the running transaction, if any, is available to get from the connection object.
static GetDialect(…) Gets the dialect for the given connection.
static GetLogger(…) Gets the logger for a connection if it implements the IHasLogger interface, or null if not.
static NewFor<TClass>(…) Creates a new connection for the specified class, determining the connection key by checking its ConnectionKeyAttribute.
static SetCommandTimeout(…) Sets the default command timeout for the given connection. Only works with IHasCommandTimeout (WrappedConnection) instances, which are usually created by SqlConnections.NewXyz methods.

See Also