Database.Exists Method

 

Checks whether or not the database exists on the server.

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

NameDescription
System_CAPS_pubmethodExists()

Checks whether or not the database exists on the server.

System_CAPS_pubmethodSystem_CAPS_staticExists(DbConnection)

Checks whether or not the database exists on the server.

System_CAPS_pubmethodSystem_CAPS_staticExists(String)

Checks whether or not the database exists on the server. 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.


Database.Exists Method ()

Checks whether or not the database exists on the server.

public bool Exists()

Return Value

Type: System.Boolean

True if the database exists; false otherwise.


Database.Exists Method (DbConnection)

Checks whether or not the database exists on the server.

public static bool Exists(
	DbConnection existingConnection
)

Parameters

existingConnection
Type: System.Data.Common.DbConnection

An existing connection to the database.

Return Value

Type: System.Boolean

True if the database exists; false otherwise.


Database.Exists Method (String)

Checks whether or not the database exists on the server. 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.

[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public static bool Exists(
	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 exists; false otherwise.