So I'm using PLINQO Linq2Sql on a large project. I was wondering if there was any way I could count the number of queries that get submitted to the SqlServer via code using either PLINQO or Linq2Sql?
Like if I wrote the code
var a = Tables.Users.FirstOrDefault(x=>x.Username == username);
var b = Tables.Apples.Where(x=>x.UID == a.UID).ToList();
var c = Tables.Pears.Where(x=>x.UID == a.UID);
The result would be 2 since the third one is still just an IQueryable.
Well, not something you want to do in a production environment.
I do not have a solution, but I guess you could start with the log property
http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.log.aspx
and code something around it.