linq to sql report tables in query
Posted
by luke
on Stack Overflow
See other posts from Stack Overflow
or by luke
Published on 2010-06-12T07:28:50Z
Indexed on
2010/06/12
7:32 UTC
Read the original article
Hit count: 263
c#
|linq-to-sql
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?
© Stack Overflow or respective owner