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

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

Postby 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
Dennis Wanke
 
Posts: 57
Joined: Tue 11 Mar 2014 07:49

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

Postby 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/5365368/what-is-the-difference-between-an-oracle-and-microsoft-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.
Shalex
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44

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

Postby 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 ...)
Dennis Wanke
 
Posts: 57
Joined: Tue 11 Mar 2014 07:49

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

Postby 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
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44

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

Postby 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.
Shalex
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44

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

Postby Dennis Wanke » Fri 11 Apr 2014 09:53

I confirm the issue is now fixed.
Dennis Wanke
 
Posts: 57
Joined: Tue 11 Mar 2014 07:49


Return to dotConnect for Oracle