Skip to content

ConnectionExtensions.NewFor<TClass> method

Creates a new connection for the specified class, determining the connection key by checking its ConnectionKeyAttribute.

public static IDbConnection NewFor<TClass>(this ISqlConnections factory)
parameter description
TClass The type of the class.
factory The connection factory.

Return Value

A new connection.

Exceptions

exception condition
ArgumentOutOfRangeException Type has no ConnectionKey attribute!

See Also