How to set ClientInfo using Entity Framework?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
cew3
Posts: 23
Joined: Wed 15 Jul 2009 14:50

How to set ClientInfo using Entity Framework?

Post by cew3 » Tue 27 Nov 2018 12:35

Hi there!

How do I set the ClientInfo using EF as I could do using an OracleConnection?
Could it be set in the connection string?

Best regards,
cew3

Shalex
Site Admin
Posts: 8501
Joined: Thu 14 Aug 2008 12:44

Re: How to set ClientInfo using Entity Framework?

Post by Shalex » Thu 29 Nov 2018 20:03

There is the ClientId parameter in connection string: https://www.devart.com/dotconnect/oracl ... tring.html. Is that what you need?

cew3
Posts: 23
Joined: Wed 15 Jul 2009 14:50

Re: How to set ClientInfo using Entity Framework?

Post by cew3 » Fri 30 Nov 2018 10:21

Shalex wrote:
Thu 29 Nov 2018 20:03
There is the ClientId parameter in connection string: https://www.devart.com/dotconnect/oracl ... tring.html. Is that what you need?
You're right. There is a parameter ClientId. But as described in:
https://www.devart.com/dotconnect/oracl ... mbers.html
  • ClientId:
    This property specifies the client identifier for the connection. It helps to make audition of the client connections and gives an opportunity to distinguish between the applications connecting to.
  • ClientInfo:
    Gets or sets the client information for the connection.
there is also a parameter ClientInfo I have to set using Entity Framework.

Best regards,
cew3

cew3
Posts: 23
Joined: Wed 15 Jul 2009 14:50

Re: How to set ClientInfo using Entity Framework?

Post by cew3 » Tue 11 Dec 2018 13:38

Hello?
Anybody out there?

Shalex
Site Admin
Posts: 8501
Joined: Thu 14 Aug 2008 12:44

Re: How to set ClientInfo using Entity Framework?

Post by Shalex » Wed 12 Dec 2018 16:08

You are working with EF4 and ObjectContext, aren't you?

Please use this approach:

Code: Select all

    using (var myObjectContext = new MyEntities())
    {
        var conn = (myObjectContext.Connection as System.Data.EntityClient.EntityConnection).StoreConnection as OracleConnection;
        conn.Open();
        conn.ClientInfo = "abcd";

        // work with myObjectContext

        conn.Close();
    }

Post Reply