ValidateEntityAfterLoad

Posts   
 
    
Fab
User
Posts: 108
Joined: 20-Oct-2008
# Posted on: 31-Oct-2008 11:31:15   

Hi

My question is quite simple I search a way to trigger some code after the load of my entity, but after all prefetch path done. So like ValidateEntityAfterLoad, but after the prefetch path has been fetched. Do you see a way to do that in llblgen ?

I've check the adapter.OnFetchEntityComplete but in this method I don't have the entity fetched... (and I don't know if it's triggered after the prefetch path fetch)

Tx for your help!

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 31-Oct-2008 12:02:37   

So like ValidateEntityAfterLoad, but after the prefetch path has been fetched.

Do you mean you want to validate after it has been prefetched? (ValidateEntityAfterLoad should work here).

Or Do you mean you want to validate an entity after its related entities have been prefetched (i.e the entire graph has been fetched)?

For the later case I see no way than a custom validation triggered manually from your business code. So you can write a validator and put your validation inside ValidateEntity(), which isn't used internally by the LLBLGen Pro runtime, but can be used by your own code to validate an entity in any context. Then you should call myEntity.ValidateEntity() anywhere you like which in turn calls your validator's ValidateEntity(). (in case a validator was assigned to the entity).

Fab
User
Posts: 108
Joined: 20-Oct-2008
# Posted on: 31-Oct-2008 13:42:36   

Yes it's the later case. And is there any location in the data access adapter (method to override) where I can call the method on the validator so I know it's called for any entity ? If I override the FetchEntity method and call first the base FetchEntity method, then the validator class, do you think it'll works ? Tx for your help

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Oct-2008 20:17:49   

I think that should work. Also, depending on the code you want to trigger, there's also the _OnAuditLoadOfEntity _method you can override. That method is executed after the entity and all its related entities had been fetched.

David Elizondo | LLBLGen Support Team
Fab
User
Posts: 108
Joined: 20-Oct-2008
# Posted on: 03-Nov-2008 12:00:29   

ok I'll try and give feedback If it doesn't works, I'll try the audit way. But I'll try to avoid that because it's not really an audit process...