OK, so one thing I do is when a page loads I fill a dropdown with all our Customer Names for example. Then later within a grid on the same page the user may change the spelling of one of the Customer Names. Both the dropdown and the grid were filled by the same datacontext; is this an example of a potential problem?
Main Topics
Browse All Topics





by: FernandoSotoPosted on 2009-07-21 at 13:35:22ID: 24909054
Hi jherington;
What you did is fine as long as the two DataContext do not reference and change the same table data.
For example lets say you have two data context, DC1 and DC2, and both of them have database A table B with Row 1 loaded from executed Linq queries. If you make a change to the values in row 1 from DC1, DC2 will not know of that change until it tries to make changes to it itself and you will receive a concurrency error on DC2. It is legal to have two data context you just need to be aware of what can go wrong.
Fernando