I have some entities that I often use without being associated with an Entity Manager (that is, they are detached). So far, I haven't run into any major issues except for one. If an exception is thrown by somebody watching the PropertyChanged event, Dev Force tries to do special logic. It looks to see if the entity is being loaded. But in my case, that check fails because the entity is not in an entity manger. And unfortunately, that means that I get a very unhelpful "NullReferenceException" and my original exception gets swallowed. The problem code that I'm running into is in EntityWrapper and looks something like this:
protected internal virtual void OnPropertyChanged(PropertyChangedEventArgs e) { if (this.PropertyChanged != null) { try { this.PropertyChanged.Invoke(this, e); } catch { if (!this.EntityManager.IsLoadingEntity) { throw; } } } } |
It seems like if the condition was changed to 'if (this.EntityManager == null || !this.EntityManager.IsLoadingEntity)', then it would behave fine for detached entities. I know this might be a weird use case, but I'm hoping it would be a pretty simple and low-risk change.
Thanks,
-Stephen