ContextWindow: Context has not to be Disposed
https://stackoverflow.com/questions/15666824/entity-framework-and-calling-context-dispose https://blog.jongallant.com/2012/10/do-i-have-to-call-dispose-on-dbcontext/
This commit is contained in:
@ -39,18 +39,11 @@ namespace Elwig.Windows {
|
||||
await OnRenewContext();
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs evt) {
|
||||
base.OnClosed(evt);
|
||||
Context.Dispose();
|
||||
}
|
||||
|
||||
protected async Task RenewContext() {
|
||||
if (!_renewPending) return;
|
||||
var old = Context;
|
||||
Context = new();
|
||||
await OnRenewContext();
|
||||
_renewPending = false;
|
||||
old.Dispose();
|
||||
}
|
||||
|
||||
abstract protected Task OnRenewContext();
|
||||
|
Reference in New Issue
Block a user