Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Dennis Wanke
Posts: 57
Joined: Tue 11 Mar 2014 07:49

Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Dennis Wanke » Sat 29 Mar 2014 15:12

Static method EntityFramework!Database.Delete(DbConnection) has no effect when dotConnect OracleConnection is supplied as a parameter (direct mode, user's schema in the database is not empty). Tried it with all different values of DatabaseScript.Schema.DeleteDatabaseBehaviour with the same result.

Expected behavior is to be the same as when calling ObjectContext.DeleteDatabase() for a context created with the same database connection.

In fact, Database.Delete() calls ObjectContext.DeleteDatabase() internally for a specially constructed "empty" context:

Code: Select all

DbModelBuilder().Build(connection).Compile().CreateObjectContext<ObjectContext>(connection)
As no StoreItemCollection is supplied in this case, the only viable option would be to delete the entire user's schema (which probably corresponds to DeleteDatabaseBehaviour.AllSchemaObjects or DeleteDatabaseBehaviour.Schema).

Similar issue: http://forums.devart.com/viewtopic.php?f=1&t=29261

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

Re: Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Shalex » Wed 02 Apr 2014 11:59

There is a difference in the meaning of schemas/databases between SQL Server and Oracle: http://stackoverflow.com/questions/5365 ... oft-schema.
Dennis Wanke wrote:Static method EntityFramework!Database.Delete(DbConnection) has no effect when dotConnect OracleConnection is supplied as a parameter (direct mode, user's schema in the database is not empty).
Which behaviour did you expect? There is no way to delete a database user which is used to establish a current connection.

We will investigate the possibility of implementing the following behaviour: Database.Delete(DbConnection) should remove all objects in the current schema (specified in the User Id or set with Initialization Command connection string parameter) if DatabaseScript.Schema.DeleteDatabaseBehaviour = AllSchemaObjects.

Initialization Command specifies a database-specific command that should be executed immediately after establishing the connection.

Dennis Wanke
Posts: 57
Joined: Tue 11 Mar 2014 07:49

Re: Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Dennis Wanke » Wed 02 Apr 2014 13:24

This is exactly what I suggested:
Dennis Wanke wrote: Expected behavior is to be the same as when calling ObjectContext.DeleteDatabase() for a context created with the same database connection.
...
As no StoreItemCollection is supplied in this case, the only viable option would be to delete the entire user's schema (which probably corresponds to DeleteDatabaseBehaviour.AllSchemaObjects ...)

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

Re: Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Shalex » Wed 09 Apr 2014 14:13

The Database.Delete(DbConnection) functionality is supported: all objects in the current schema (specified in User Id or set with Initialization Command connection string parameter) are removed if DatabaseScript.Schema.DeleteDatabaseBehaviour = AllSchemaObjects. We will notify you when the corresponding build of dotConnect for Oracle is available for download.

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

Re: Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Shalex » Thu 10 Apr 2014 14:13

New build of dotConnect for Oracle 8.3.135 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=29348.

Dennis Wanke
Posts: 57
Joined: Tue 11 Mar 2014 07:49

Re: Static method Database.Delete(DbConnection) from EntityFramework.dll doesn't work

Post by Dennis Wanke » Fri 11 Apr 2014 09:53

I confirm the issue is now fixed.

Post Reply