Is it possible to determine if an IQueryable<Object> is a LINQ-to-sql object or not? (Has a SQL statement as its source)
Is it possible to determine if an IQueryable<Object> is a LINQ-to-sql object or not?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, a DataContext returns
System.Data.Linq.Table<T>s (IQueryable<T>) orSystem.Data.Linq.ITables (IQueryable), so you can test whether your IQueryable instanceisone of these.Edit:
When a Linq operation (like
Select, orOrderBy) is applied to theIQuerablethe result is aSystem.Data.Linq.DataQuery. This is an internal type, so you cannot use theisoperator. In stead, doy.GetType().FullName.StartsWith("System.Data.Linq.DataQuery`1").