Database.Exists Database.Exists Database.Exists Method

Definition

Overloads

Exists() Exists() Exists()

Checks whether or not the database exists on the server.

Exists(DbConnection) Exists(DbConnection) Exists(DbConnection)

Checks whether or not the database exists on the server.

Exists(String) Exists(String) Exists(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.

Exists() Exists() Exists()

Checks whether or not the database exists on the server.

public bool Exists ();
member this.Exists : unit -> bool
Public Function Exists () As Boolean

Returns

True if the database exists; false otherwise.

Exists(DbConnection) Exists(DbConnection) Exists(DbConnection)

Checks whether or not the database exists on the server.

public static bool Exists (System.Data.Common.DbConnection existingConnection);
static member Exists : System.Data.Common.DbConnection -> bool
Public Shared Function Exists (existingConnection As DbConnection) As Boolean

Parameters

existingConnection
DbConnection DbConnection DbConnection

An existing connection to the database.

Returns

True if the database exists; false otherwise.

Exists(String) Exists(String) Exists(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.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public static bool Exists (string nameOrConnectionString);
static member Exists : string -> bool
Public Shared Function Exists (nameOrConnectionString As String) As Boolean

Parameters

nameOrConnectionString
String String String

The database name or a connection string to the database.

Returns

True if the database exists; false otherwise.

Applies to