I use DataContexts for 90% of my data access. But if, for instance, User1 modifies a record and User2 query the DataContext, he won’t see the modifications. So I recreate my DataContext EVERY time I acces data (before every LINQ to SQL use).
There must be a better way to query the tables! Either I have to get DataContexts to be synchronized with the tables, either I have to find a way to directly query the tables.
Any help would be appreciated!
Thank you!
No, there is no better way and there is no need for one.
Creating a DataContext is relatively cheap, the only expensive part is the Connection and that is handled by the ConnectionPool.
So you can just think and reason in terms of Queries (they are the real expense) and the alternative, caching resultsets.