DatabaseFacade.CanConnect Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether or not the database is available and can be connected to.
public virtual bool CanConnect ();
abstract member CanConnect : unit -> bool
override this.CanConnect : unit -> bool
Public Overridable Function CanConnect () As Boolean
Returns
true
if the database is available; false
otherwise.
Remarks
Any exceptions thrown when attempting to connect are caught and not propagated to the application.
The configured connection string is used to create the connection in the normal way, so all configured options such as timeouts are honored.
Note that being able to connect to the database does not mean that it is up-to-date with regard to schema creation, etc.
See Database connections in EF Core for more information and examples.
Applies to
Entity Framework
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: Under hela 2024 kommer vi att fasa ut GitHub-problem som feedbackmekanism för innehåll och ersätta det med ett nytt feedbacksystem. Mer information finns i:Skicka och visa feedback för