ConnectionExtensions.NewFor<TClass> method
namespace: Serenity.Data assembly: Serenity.Net.Data
Creates a new connection for specified class, determining the connection key by checking its [ConnectionKey] attribute.
public static IDbConnection NewFor<TClass>(this ISqlConnections factory)
| parameter | description |
|---|---|
| TClass | The type of the class. |
| factory | Connection factory |
Return Value
A new connection
Exceptions
| exception | condition |
|---|---|
| ArgumentOutOfRangeException | Type has no ConnectionKey attribute! |
See Also
- interface ISqlConnections
- class ConnectionExtensions