OnFetch / GetMulti

Posts   
 
    
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 19-Jan-2009 12:38:21   

OnFetch (or OnFetchComplete) doesn't seem to be executed when an entity is 'fetched' via GetMulti (as opposed to Fetch using PK, which does.

Is there a reason for this? Another overridable method to use? (perhaps in the collection class?)

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 19-Jan-2009 14:47:33   

Which runtime library is this?

MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 19-Jan-2009 15:15:55   

I'm reasonably sure I've got the latest ones (or the ones before the 19 / 12/ 2008 )

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Jan-2009 07:44:25   

Hi Matthew,

I actually can override the _OnFetch _and _OnFetchComplete _methods of a particular entity. When testing in a _GetMulti _call, the my _OnFetchComplete _method is called, my _OnFetch _method is not. We will investigate this. In the meantime, please override the **OnFetchComplete **method.

I don't know what LLBLGen version are you using (v2.0, 2.5, 2.6, etc.). Please make sure to upgrade to the latest runtime library of your llblgen version.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 22-Jan-2009 10:43:04   

The OnFetch() is called in the Fetch routines generated into the code, and is for single-entity fetches.

For multi-entity fetches, it doesn't make sense, as there just 1 fetch: the collection fetch which is equal for every entity (which are only known AFTER the data is fetched) in the fetched set. For every entity the OnFetchComplete is called as that's a situation which is different for every entity fetched.

As there's no entity specific fetch logic defined, calling it would make no sense. Calling OnFetchComplete does, as the entity itself is then fully fetched and post-fetch logic can be ran.

Though calling OnFetch() right before the entity data is placed inside the entity object is not really possible as it would not be a call before the actual fetch, as with Fetch in the generated code to fetch data into the object the method is defined in, as the fetch already took place (with 1 query for all the entities).

I'm not sure what you want to accomplish in the OnFetch override, if you can explain that abit, perhaps there's a different method to override instead.

Frans Bouma | Lead developer LLBLGen Pro
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 22-Jan-2009 10:49:19   

Hi Frans,

I'd read your post on OnFetchComplete / OnFetch in GetMulti here:

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6628&HighLight=1

Actually OnFetchComplete would work for me, but didn't seem to fire for me when I tested it .

I'll try again, and report back

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 22-Jan-2009 10:56:51   

MattE wrote:

Hi Frans,

I'd read your post on OnFetchComplete / OnFetch in GetMulti here:

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6628&HighLight=1

I didn't look at that thread when I wrote my message above, luckily I was consistent with that post sunglasses

Actually OnFetchComplete would work for me, but didn't seem to fire for me when I tested it . I'll try again, and report back

Ok. The call is made in DaoBase.cs, line 1509.

Frans Bouma | Lead developer LLBLGen Pro