I am using Entityframework 6 Database first. The application am building will allow users to change connection string. After I tested the newly entered connection string validity, I wanted to check if the tables that are on edmx models really exist on the given connection string.
So I tried this:
let say I have ExampleEntity on edmx.. to check if it exist on real database table I used..
try{
dbContext.ExampleEntity.ToList();
return true; // the table exist
}
catch{
return false;
}
Is there a better way to check the existence of the database tables using Entityframework?