protected override void DisposeCore() { if (_dataContext != null) { _dataContext.Dispose(); } }
private void closeForm_Click(object sender, EventArgs e) { // Dispose the object context. schoolContext.Dispose(); this.Close(); }
protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
protected virtual void Dispose(bool disposing) { if (!this.disposedValue) { if (disposing) { context.Dispose(); } } this.disposedValue = true; }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { _context.Dispose(); } } this.disposed = true; }
public static void Main() { var context = new SchoolEntities(); foreach (Comment comment in context.Comments) { var likes = comment.AdditionalTables; Console.WriteLine(likes.FirstOrDefault()?.CommentId); } Console.ReadLine(); context.Dispose(); }