Okay, so I have this LINQ to SQL situation. I have a DataContext object which links to an SQL database and I can get tables and... all of that business. This is all inside a WCF service inside IIS.
Now I connect the DataContext object when I declare it, which is at the top of the class, as follows:
DataContext dc = new DataContext([ConnectionString]);
Then, later, I have methods to do things like inserting a Client (that is a type of entity), and that looks something like this:
public void InsertClient(Client client)
{
if(client.ClientID > 0)
return;
dc.Clients.InsertOnSubmit(client);
dc.SubmitChanges();
}
The problem is basically... is there some way to test that connection? What if someone pulled a plug or something before SubmitChanges? It's not like it returns anything, so it couldn't tell me there was a particular error.
How would people recommend I do this?
Thanks.