private void Finding(object sender, WidgetIdEventArgs e) { using (var context = new MvpWebFormsContext()) { var widget = context.Widgets.Find(e.Id); if (widget != null) { View.Model.Widgets.Add(widget); View.Model.ShowResult = true; } } }
private async Task FindingAsync(int id) { // TODO: Add CancellationToken using (var context = new MvpWebFormsContext()) { var widget = await context.Widgets.FindAsync(id); if (widget != null) { View.Model.Widgets.Add(widget); View.Model.ShowResult = true; } } }
private void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_dbContext != null) { _dbContext.Dispose(); _dbContext = null; } } _disposed = true; } }