Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,548

filter by tags archive

Profiler new features: Data binding alerts

time to read 2 min | 291 words

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:

image

 

image

WinForms detections:

image

image

Web applications:

image

image


Comments

tobi

A nice step to counteract the counterproductive trend in the .NET world to rely on such practices for dubious code savings.

configurator

So that's why you needed to look at the stack trace!

José F. Romaniello

Can you detect if a lazy property was initialized because a databinding?

that will be really useful.

thanks

Ayende Rahien

Jose,

Yes, that will detect this as well

Nigel Sampson

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

anon

efprof-735 throws bad image format exception on my xp machine.

Ayende Rahien

Anon,

Yes, there was an issue with uploading to the server.

Build 738 fixes the issue

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. The low level interview question - 35 minutes from now
  2. The worker pattern - 3 days from now

There are posts all the way to May 30, 2016

RECENT SERIES

  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats