OnValidateEntityBeforeDelete

Posts   
 
    
paulshealy
User
Posts: 22
Joined: 13-Jun-2005
# Posted on: 12-Jul-2006 21:31:30   

I'm having trouble with the OnValidateEntityBeforeDelete event on an entity (SelfServicing, 2.0). When I do this


LPTHotelColumnEntity e = new LPTHotelColumnEntity (1473);
tx.Add (e);
e.Delete();

and set a breakpoint on OnValidateEntityBeforeDelete (), it isn't hit. I've verified that the entity is being deleted in the DB. I've also tried the same thing with OnValidateEntityBeforeSave() and that one works fine.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Jul-2006 22:54:08   

Will look into it.

Frans Bouma | Lead developer LLBLGen Pro
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 13-Jul-2006 00:01:57   

Otis wrote:

Will look into it.

A similar question. When writting unit tests we wanted to avoid going to the db if possible to test business rules. To do this we tried calling ValidateEntity() in the test. But, that didn't seem to fire the OnValidateBeforeSave() etc method. Is this by design?

BOb

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 13-Jul-2006 09:35:29   

ValidateEntity is a general validation method which isn't used by the LLBLGen Pro framework, but can be used by your own code to validate an entity at any given moment.

You may want to have general validation for an entity that is different than the validation before the save action, and the validation before the delete action...etc.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Jul-2006 12:42:07   

OnValidateEntityBeforeDelete() doesn't seem to be called from code in selfservicing. This will be a template patch. Sorry for this inconvenience.

(edit) fixed in next build

Frans Bouma | Lead developer LLBLGen Pro
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 13-Jul-2006 22:07:50   

Walaa wrote:

ValidateEntity is a general validation method which isn't used by the LLBLGen Pro framework, but can be used by your own code to validate an entity at any given moment.

When you say "isn't used" are you saying there is no default implementation for it that calls the same methods to validate the entity that Save would call? So, it is just an empty template method?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Jul-2006 22:57:19   

It's a method which isn't called by LLBLGen Pro code, it's a method for you to call if you want to.

Frans Bouma | Lead developer LLBLGen Pro