public static void WithSubmit(Action <DownloadDataContext> op)
 {
     using (var db = new DownloadDataContext()) {
         op(db);
         db.SubmitChanges();
     }
 }
 public static void CreateIfNotExists()
 {
     // Creates the database if it does not yet exist.
     using (var db = new DownloadDataContext()) {
         if (db.DatabaseExists() == false)
         {
             db.CreateDatabase();
         }
     }
 }
 public static T WithConnection <T>(Func <DownloadDataContext, T> op)
 {
     using (var db = new DownloadDataContext()) {
         return(op(db));
     }
 }