Share via


Database.Exists Method

Definition

Overloads

Exists()

Checks whether or not the database exists on the server.

Exists(DbConnection)

Checks whether or not the database exists on the server.

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()

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.

Applies to

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

An existing connection to the database.

Returns

True if the database exists; false otherwise.

Applies to

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.

public static bool Exists (string nameOrConnectionString);
[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

The database name or a connection string to the database.

Returns

True if the database exists; false otherwise.

Attributes

Applies to