次の方法で共有


ObjectContext.DatabaseExists メソッド

[このページは、Entity Framework 6 に関するページです。最新バージョンは、'Entity Framework' NuGet パッケージとして入手できます。Entity Framework の詳細については、msdn.com/data/ef を参照してください。]

現在のストア接続でデータベースとして指定されているデータベースがストアに存在するかどうかを確認します。 実際の作業のほとんどは、現在のストア接続の DbProviderServices 実装によって実行されます。

名前空間:  System.Data.Entity.Core.Objects
アセンブリ:  EntityFramework (EntityFramework.dll 内)

構文

'宣言
<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")> _
Public Overridable Function DatabaseExists As Boolean
'使用
Dim instance As ObjectContext 
Dim returnValue As Boolean 

returnValue = instance.DatabaseExists()
[SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public virtual bool DatabaseExists()
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1031:DoNotCatchGeneralExceptionTypes")]
public:
virtual bool DatabaseExists()
[<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")>]
abstract DatabaseExists : unit -> bool 
[<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")>]
override DatabaseExists : unit -> bool
public function DatabaseExists() : boolean

戻り値

型 : System.Boolean
データベースが存在する場合は true。それ以外の場合は false。

参照

参照

ObjectContext クラス

System.Data.Entity.Core.Objects 名前空間