public ActionResult Index() { var dc = new DataClassesDataContext(ConnectionString); ViewBag.DBExists = dc.DatabaseExists(); return View(); }
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; } }