Reputation: 34515
How to check if Linq.DataContext object is filled with data and no connection error has appeared?
Thanks.
Upvotes: 9
Views: 8650
Reputation: 1062820
What specific scenario are you trying to guard against?
A DataContext is not the same as a DataSet - it isn't (necessarily) a container of data (identity management / change tracking aside) - it is a source of data.
In general, it won't give you an object (from a query) if an error occurs - it'll throw an exception. So if you have been given an instance by LINQ-to-SQL, it should have something in it.
Are you seeing a specific problem that you want to avoid?
Upvotes: 2