Profiler new features: Data binding alerts
The following features apply to NHProf, EFProf, L2SProf.
In general, it is strong discouraged to data bind directly to an IQueryable. Mostly, that is because data binding may actually iterate over the IQueryable several times, resulting in multiple queries being generated from something that can be done purely in memory. Worse, it is actually pretty common for data binding to result in lazy loading, and lazy loading from data binding almost always result in SELECT N+1. The profiler can now detect and warn you about such mistakes preemptively. More than that, the profiler can also now detect queries that are being generated from the views in an ASP.Net MVC application, another bad practice that I don’t like.
You can find more information about each warnings here:
WPF detection:
WinForms detections:
Web applications:
Comments
A nice step to counteract the counterproductive trend in the .NET world to rely on such practices for dubious code savings.
So that's why you needed to look at the stack trace!
Can you detect if a lazy property was initialized because a databinding?
that will be really useful.
thanks
Jose,
Yes, that will detect this as well
Very cool, I ended up handling this by disposing of my unit of work at the end of the action (through an ActionFilter) which means that any lazy evaluation in the view throws an exception.
Cheers
That is amazingly awesome. Great idea.
efprof-735 throws bad image format exception on my xp machine.
Anon,
Yes, there was an issue with uploading to the server.
Build 738 fixes the issue
Comment preview