OnFetchComplete for adapter?

Posts   
 
    
silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 25-Jul-2006 23:48:29   

Hello All,

OnFetchComplete does not seem to exist in the adapter model.

How can I add some logic "on fetch complete" of an entity?

Thanks,

Silat

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 26-Jul-2006 03:10:30   

Try OnFetchEntityComplete

silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 26-Jul-2006 08:22:30   

This one does not exist for Entity.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 26-Jul-2006 09:45:35   

If you want to add validation logic, add it to OnValidateEntityAfterLoad in the entity. What kind of logic do you want to add?

Frans Bouma | Lead developer LLBLGen Pro
silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 26-Jul-2006 09:51:26   

This is not really validation logic.

I need to do some processing before inserting into the DB(OnBeforeEntitySave) and after getting data from DB (OnFetch???).

In fact, I have an HTML field (on which I have fulltext search), therefore to enable the fulltext indexation, before inserting the data I am adding a blank around each tag.

Then, when I fetch it from DB, I have to : - remove all the extra blank. - set this field to IsDirty = false;

Because if I put directly <tag>Hello</tag> in my DB, then Hello will not be indexed.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 26-Jul-2006 14:39:00   

I think that OnValidateEntityAfterLoad() would be a nice option. But if you see it does not belong there and it should be somewhere else, then I suggest it belongs to business logic and should be implemented in some manager class, from which you call a method just after you fetch the entity.

I found the following note a useful one to read(copied from LLBLgen Pro manual "Concepts - N-tier development"):

Business logic and where to put it Where to put your business logic code? The section Using the generated code goes more deeply into the question where Business Logic code can be placed in combination with the generated code. There are roughly three kinds of business logic or better: business logic rules:

1- Field oriented business logic rules. Example: ID > 0. 2- Entity wide oriended business logic rules. Example: Ship date >= order date 3- Cross entity oriented business logic rules. Example: Customer is gold customer if customer has purchased at least n orders in the last m months

In LLBLGen Pro, type 1 and 2 are done through Validator classes, which implement IValidator. Validator classes can be generated for each entity by enabling the task to generate them in the run queue when generating code, they're not generated by default. You can also opt for implementing the type 1 and type 2 code inside an entity, for example by using a partial class. Typically you then override the validation methods like OnValidateEntityAfterLoad() and similar methods. Type 3 are stored in classes placed on top of the generated code, so called manager classes which manage a process or sub- process. LLBLGen Pro offers several options for you to add type 1 and type 2 code to the generated code in a safe manner. Please consult Adding your own code to the generated classes for details.

silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 26-Jul-2006 15:05:57   

Thanks Walaa,

I will put it into the manager classe together with the save.

Silat.