How to check if Linq.DataContext object is filled with data and no connection error has appeared?
Thanks.
DataContext.DatabaseExists()
or
DataContext.Connection.Open()
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With