public void Dispose() { if (contextWrapper != null) { contextWrapper.EntityLoaded -= OnEntityLoaded; contextWrapper.Dispose(); } }