Esempio n. 1
0
 public ActionResult Index()
 {
     var dc = new DataClassesDataContext(ConnectionString);
     ViewBag.DBExists = dc.DatabaseExists();
     return View();
 }
Esempio n. 2
0
 protected void Application_Error(object sender, EventArgs e)
 {
     // In the event of an unhandled exception, reverse any changes that were made to the database to avoid any partial database updates.
     var dataContext = DataContextSimple;
     if (dataContext != null) {
         dataContext.Transaction.Rollback();
         dataContext.Connection.Close();
         dataContext.Dispose();
         DataContextSimple = null;
     }
 }