Share via


Database.CreateIfNotExists 方法

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

在資料庫伺服器上針對支援內容中所定義的模型建立新的資料庫,但前提是伺服器上尚未有同名的資料庫存在。

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

語法

'宣告
Public Function CreateIfNotExists As Boolean
'用途
Dim instance As Database 
Dim returnValue As Boolean 

returnValue = instance.CreateIfNotExists()
public bool CreateIfNotExists()
public:
bool CreateIfNotExists()
member CreateIfNotExists : unit -> bool
public function CreateIfNotExists() : boolean

傳回值

類型:System.Boolean
如果資料庫尚未存在但是已建立則為 true,否則為 false。

請參閱

參考

Database 類別

System.Data.Entity 命名空間