共用方式為


DbProviderServices.DbDatabaseExists 方法 (DbConnection, Nullable<Int32>, StoreItemCollection)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

傳回值,指出給定的資料庫是否存在伺服器上。

命名空間:  System.Data.Entity.Core.Common
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Protected Overridable Function DbDatabaseExists ( _
    connection As DbConnection, _
    commandTimeout As Nullable(Of Integer), _
    storeItemCollection As StoreItemCollection _
) As Boolean
'用途
Dim connection As DbConnection 
Dim commandTimeout As Nullable(Of Integer)
Dim storeItemCollection As StoreItemCollection 
Dim returnValue As Boolean 

returnValue = Me.DbDatabaseExists(connection, _
    commandTimeout, storeItemCollection)
protected virtual bool DbDatabaseExists(
    DbConnection connection,
    Nullable<int> commandTimeout,
    StoreItemCollection storeItemCollection
)
protected:
virtual bool DbDatabaseExists(
    DbConnection^ connection, 
    Nullable<int> commandTimeout, 
    StoreItemCollection^ storeItemCollection
)
abstract DbDatabaseExists : 
        connection:DbConnection * 
        commandTimeout:Nullable<int> * 
        storeItemCollection:StoreItemCollection -> bool  
override DbDatabaseExists : 
        connection:DbConnection * 
        commandTimeout:Nullable<int> * 
        storeItemCollection:StoreItemCollection -> bool
protected function DbDatabaseExists(
    connection : DbConnection, 
    commandTimeout : Nullable<int>, 
    storeItemCollection : StoreItemCollection
) : boolean

參數

  • commandTimeout
    類型:System.Nullable<Int32>
    判斷資料庫存在與否所需之任何命令的執行逾時時間。

傳回值

類型:System.Boolean
如果提供者只能根據連接推算資料庫,則為 true。

請參閱

參考

DbProviderServices 類別

DbDatabaseExists 多載

System.Data.Entity.Core.Common 命名空間