entity validator question

Posts   
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 01-May-2006 15:35:08   

Hello, I have a question about:

Entity collection classes no longer set EntityValidator instances and Validator instances on entities added to them. The two properties EntityValidatorToUse and ValidatorToUse have been made obsolete. The warnings resulting this obsoleteness have to be corrected to make the code work again. They've been kept to make forms still be designable in VS.NET. Entities get their validator automatically when they're instantiated, if the proper method is overriden, no longer do they need to get their validator object set by a collection they're contained in.

It's hard to tell from this and I haven't looked deeper into the betas yet, but how do you add or remove entity validations in 2.0?

For instance in the current version. I can remove entityvalidators by simple setting EntityValidatorToUse to null or attach any kind of validator I want on the fly to the property. Will this functionality still exist in 2.0? This is a major feature we use. I doesn't matter if it's done a different way now, we can change the code, but I just want to make sure the feature is still in there. We have to be able to remove or change validators on the fly.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 01-May-2006 16:14:59   

jspanocsi wrote:

Hello, I have a question about:

Entity collection classes no longer set EntityValidator instances and Validator instances on entities added to them. The two properties EntityValidatorToUse and ValidatorToUse have been made obsolete. The warnings resulting this obsoleteness have to be corrected to make the code work again. They've been kept to make forms still be designable in VS.NET. Entities get their validator automatically when they're instantiated, if the proper method is overriden, no longer do they need to get their validator object set by a collection they're contained in.

It's hard to tell from this and I haven't looked deeper into the betas yet, but how do you add or remove entity validations in 2.0?

It's now done in a class derived from validatorbase. In short: IEntityValidator and IValidator have been merged into IValidator and enhanced. This was a design-change we had to go through and because this is a major version increase we found this the best oppertunity to make this breaking change.

please consult the enclosed docs' validation topic in the beta docs section for more info on this.

For instance in the current version. I can remove entityvalidators by simple setting EntityValidatorToUse to null or attach any kind of validator I want on the fly to the property. Will this functionality still exist in 2.0?

Yes. You now don't have to set 2 validators (entity.ValidatorToUse and entity.EntityValidatorToUse), but one: entity.Validator

This is a major feature we use. I doesn't matter if it's done a different way now, we can change the code, but I just want to make sure the feature is still in there. We have to be able to remove or change validators on the fly. Thanks

It's still there and greatly enhanced. you can now validate in more situations, and as everything is in 1 class it's easier to maintain the code.

Frans Bouma | Lead developer LLBLGen Pro