motor75
motor75

Reputation: 45

Setting ClientID on OracleConnection object via Dapper

In rewriting a web service in C# using Dapper, I need the ability to set the OracleConnection object's ClientID property. This is used by various triggers in our Oracle database to note the user that modified the data.

Is there any way to access or set this property via Dapper? I've searched and have come up empty. I like the convenience of Dapper, but I'm afraid these intricate database-specific settings may not be available to be read or modified. Any thoughts or help would be greatly appreciated.

Upvotes: 0

Views: 549

Answers (1)

Parrish Husband
Parrish Husband

Reputation: 3178

Dapper just extends off of your DbConnection, so there's no need for it to get involved.

You would set the ClientId directly on the OracleConnection

https://docs.oracle.com/cd/B28359_01/win.111/b28375/OracleConnectionClass.htm#DAFCFAHF

using (OracleConnection connection = new OracleConnection(conectionString))
{
    connection.ClientId = "MyClientId";
    connection.{DapperStuff}();
}

Upvotes: 2

Related Questions