linq to sql report tables in query
- by luke
Here's the method i want to write:
public static IEnumerable<String> GetTableNames(this IQueryable<T> query)
{
//...
}
where the IQueryable is a linq-to-sql query (is there a more specific interface i should use?).
then if i had a query like this
var q = from c in db.Customers
from p in db.Products
where c.ID = 3
select new {p.Name, p.Version};
q.GetTableNames();// return ["Customers", "Products"]
basically it would show all the tables that this query touches in the db, it is ok to execute the query to figure this out too (since that is going to happen anyway)? any ideas?