I am currently experimenting with LinqConnect. The DB class opens a connection to a MySQL database that will fail. I was expecting the Linq query to raise an exception but it didn't. The variable contacts has an error message "Error on opening DbConnection.", though. Is there a way to get DataContext an exception with the database connection fails ?
Thanks
Code: Select all
try
{
var db = new DB();
var contacts = (from c in db.People select c);
return contacts;
} catch (Exception e)
{
Console.WriteLine(e);
return Negotiate
.WithModel(new Failure() { error = "database error" })
.WithStatusCode(HttpStatusCode.InternalServerError);
}