共用方式為


DbProviderServices.DbCreateDatabase 方法

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

建立連接所表示的資料庫,並根據 StoreItemCollection 的內容建立結構描述物件 (資料表、主索引鍵、外部索引鍵)。

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

語法

'宣告
Protected Overridable Sub DbCreateDatabase ( _
    connection As DbConnection, _
    commandTimeout As Nullable(Of Integer), _
    storeItemCollection As StoreItemCollection _
)
'用途
Dim connection As DbConnection 
Dim commandTimeout As Nullable(Of Integer)
Dim storeItemCollection As StoreItemCollection 

Me.DbCreateDatabase(connection, commandTimeout, _
    storeItemCollection)
protected virtual void DbCreateDatabase(
    DbConnection connection,
    Nullable<int> commandTimeout,
    StoreItemCollection storeItemCollection
)
protected:
virtual void DbCreateDatabase(
    DbConnection^ connection, 
    Nullable<int> commandTimeout, 
    StoreItemCollection^ storeItemCollection
)
abstract DbCreateDatabase : 
        connection:DbConnection * 
        commandTimeout:Nullable<int> * 
        storeItemCollection:StoreItemCollection -> unit  
override DbCreateDatabase : 
        connection:DbConnection * 
        commandTimeout:Nullable<int> * 
        storeItemCollection:StoreItemCollection -> unit
protected function DbCreateDatabase(
    connection : DbConnection, 
    commandTimeout : Nullable<int>, 
    storeItemCollection : StoreItemCollection
)

參數

  • connection
    類型:System.Data.Common.DbConnection
    與不存在之資料庫的連接,需要建立此資料庫並在其中填入以 storeItemCollection 參數表示的存放區物件。
  • commandTimeout
    類型:System.Nullable<Int32>
    建立資料庫時所需之任何命令的執行逾時時間。

請參閱

參考

DbProviderServices 類別

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