Database::Delete Method

 

Deletes the database on the database server if it exists, otherwise does nothing.

Namespace:   System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodDelete()

Deletes the database on the database server if it exists, otherwise does nothing. Calling this method from outside of an initializer will mark the database as having not been initialized. This means that if an attempt is made to use the database again after it has been deleted, then any initializer set will run again and, usually, will try to create the database again automatically.

System_CAPS_pubmethodSystem_CAPS_staticDelete(DbConnection^)

Deletes the database on the database server if it exists, otherwise does nothing.

System_CAPS_pubmethodSystem_CAPS_staticDelete(String^)

Deletes the database on the database server if it exists, otherwise does nothing. The connection to the database is created using the given database name or connection string in the same way as is described in the documentation for the DbContext class.

Return to top

Database::Delete Method ()

Deletes the database on the database server if it exists, otherwise does nothing. Calling this method from outside of an initializer will mark the database as having not been initialized. This means that if an attempt is made to use the database again after it has been deleted, then any initializer set will run again and, usually, will try to create the database again automatically.

public:
bool Delete()

Return Value

Type: System::Boolean

True if the database did exist and was deleted; false otherwise.

Return to top

Database::Delete Method (DbConnection^)

Deletes the database on the database server if it exists, otherwise does nothing.

public:
static bool Delete(
	DbConnection^ existingConnection
)

Parameters

existingConnection
Type: System.Data.Common::DbConnection^

An existing connection to the database.

Return Value

Type: System::Boolean

True if the database did exist and was deleted; false otherwise.

Return to top

Database::Delete Method (String^)

Deletes the database on the database server if it exists, otherwise does nothing. The connection to the database is created using the given database name or connection string in the same way as is described in the documentation for the DbContext class.

public:
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
static bool Delete(
	String^ nameOrConnectionString
)

Parameters

nameOrConnectionString
Type: System::String^

The database name or a connection string to the database.

Return Value

Type: System::Boolean

True if the database did exist and was deleted; false otherwise.

Return to top
Show: