Catching bug with InvalidCastException while mapping SQL query results to object
Hi! I'm using LINQ in real product development. It is great even now!!
I use
public System.Collections.Generic.IEnumerable<T> ExecuteQuery<T>(string query,paramsobject[] parameters);
to obtain query results and map them to my object.
It works fine until I've changed query string (changes does not affect query schema but only data).
There's anSystem.InvalidCastExceptionwithMessage="Specified cast is not valid."while trying to enumerate result. By commenting different properties of my class I've found out where the problem is. But this approach is time consuming. Here is the question:
How to find out which property mapping caused exception?

