protected override void OnStop() { ServiceLog.WriteErrorLog("Mail service stopped"); timer.Stop(); timer.Dispose(); db.Dispose(); }
private void CalendarClosing(object sender, FormClosingEventArgs e) { using (CalendarDBContext db = new CalendarDBContext()) { db.SaveChanges(); db.Dispose(); } }
protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }