Is it good to use databinding to Entity Framework's Entity in WPF?
I created a singleton entity framework context:
- To have only one connection and it won't open and close all the time.
- So I can pass the Entity around to any class, and can modify the Entity and make changes to the database.
All ViewModels getting the entity out from the same Context and databinding to the View saves me time from mapping new object, but now I imagine there is problem in not using the newest Context:
A ViewModel databinding to a Entity, then someone else updated the data. The ViewModel will still display the old data, because the Context is never being dispose to refresh.
I always create new Context and then dispose of it. If I want to pass the Entity around, then there will be conflicts between Context and Entity.
What is the suggested way of doing this ?