Connection.Database property is empty

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
labate
Posts: 48
Joined: Tue 17 Jan 2006 13:57
Location: Switzerland, Sion

Connection.Database property is empty

Post by labate » Wed 22 Dec 2010 14:46

Hello,

I noticed that the property Connection.Database of my context is always empty.

The documentation says "Gets the name of the current database after a connection is opened, or the database name specified in the connection string before the connection is opened."

In fact, when my connection is closed, ctx.Connection.Database is empty.
After a ctx.Connection.Open(), this property is still empty.

I would like to get the current database type (Oracle, SQLServer) in order to execute a special store command. With this Database property always empty, I have no way to do that, except by inspecting the ServerVersion property that is equals to "Oracle Database 11g Release 11.2.0.1.0 - 64bit Production", but I would like to find a better solution.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 22 Dec 2010 16:44

I have just made a couple of tests, SQL Server-based data models do not set the EntityConnection.Database property as well.
We will investigate the possibility to add the requested functionality.
I will let you know about the results of our investigation.

labate
Posts: 48
Joined: Tue 17 Jan 2006 13:57
Location: Switzerland, Sion

Post by labate » Wed 22 Dec 2010 17:39

Thank you, keep me informed.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 24 Dec 2010 09:49

There is no way to override the default behaviour of the EntityConnection.Database property.
I recommend you the following way to check instead:

Code: Select all

if((ctx.Connection as EntityConnection).StoreConnection.GetType().Name == "OracleConnection")

Post Reply