locked
ObjectDataSource calls SelectMethod twice [VIDEO] RRS feed

  • Question

  • User-1940569877 posted

    hi all, long time reader, first time poster.

    i'm having an issue w/the ODS calling it's SelectMethod twice (instant back-to-back calls), every time it DataBinds.  everything is explained in this video.  i hope someone can help resolve this; thanks for looking.

    ods double SELECTs

    NOTE: this is an mp4 HTML video.  on my board, FireFox 27.0.1 does not play the audio for some reason (suspect an AAC encoding issue).  however, it runs well for me in Chrome 33 and IE 11.

    Monday, March 10, 2014 1:11 PM

All replies

  • User697462465 posted

    Hi jagerschmidt,

    From your description, it seems that you’re worried about the duplicated invoking of select method in ObjectDataSource while postback occurs, right?

    Actually, you don’t need to worry about the performance issue, since ObjectDataSource has its own cache mechanism. The ObjectDataSource control's cache is maintained internally, and the cache is created and used during the Select method of the ObjectDataSource, which means, when ObjectDataSource.Select method is called, it will check the cache to see whether it should use cache or re-execute the query from the underlying data access class. What you should do is just to make sure if the ObjectDataSource control has data caching enabled.

    More information please refer to:
    http://forums.asp.net/t/1161164.aspx?ObjectDataSource+Select+method+getting+called+twice

    Hope it helps.

    Best Regards,
    Terry Guo

    Tuesday, March 11, 2014 3:23 AM
  • User-1940569877 posted

    thanks Terry, i appreciate the response.

    i had already read the thread you reference in my research.  i had also enabled ODS caching to test the property and it did indeed stop the double SELECT.

    however, i have inherited a poorly engineered application and server memory is already burdened enough (session state); so this is not a fix for me.

    there's also still no explanation as to why the ODS is SELECTing twice.  i don't agree with your statement "you don't need to worry about the performance issue."  my demonstration clearly shows the DB getting hit twice.  if this page is requested 10,000 times a day, the DB is getting hit 20,000 times - for no reason.

    Tuesday, March 11, 2014 12:31 PM