Can I check wheter Linq 2 SQL's DataContext is tracking entities?
- by Thomas Jespersen
We want to throw an exception, if a user calls DataContext.SubmitChanges() and the DataContext is not tracking anything.
That is... it is OK to call SubmitChanges if there are no inserts, updates or deletes. But we want to ensure that the developer didn't forget to attach the entity to the DataContext.
Even better... is it possible to get a collection of all entities that the DataContext is tracking (including those that are not changed)?
PS: The last question I asked were answered with: "do it this way instead"... please don't :-)