0

Here is my question: does anyone know how to set up custom validation for NetTiers entities?

I have a NetTiers web solution that was generated with the EntLib 4.1 validation app block. The actual entities' properties are decorated with the validation attributes to ensure that the dataase integrity is maintained. What I need to do is add custom validation to the entities.

I know how to write the custom validators. I'm just not sure how to wire them up to the each entities so that I can perform custom validation. What I am looking for is an overview on how to do this.

Any help would be appreciated.

Thanks,

Joe

Joe
  • 1
  • 2

1 Answers1

0

Are you using the latest release of .netTiers? Support for data annotations was added in this patch and committed to core.

I would take a look at the following documentation. I'm thinking that this is something that you would need to wire up programmatically. Well make sure that this scenario works in v3.

Blake Niemyjski
  • 3,432
  • 3
  • 25
  • 41
  • We are using .netTiers v2.3.0.812. I know need to do this programattica lly. I guess that my questions is given that the validate method is called in the EntityBaseCore class, I'm not sure how to wire up a custom validator in the code (I tried to add an overridden Validate method in an entity and had no luck.) I need more details. Do you know of an example showing how this is donw? – Joe Jun 17 '11 at 14:50
  • Blake, here's another question: in the EntityBaseCore.generated.cs file is the code that returns a validator using the ValidationFactory. My question is how does the factory know which validator to return since there is no config file in the Entities project? Thanks. – Joe Jun 17 '11 at 15:06
  • Joe, I'd strongly urge you to update to the latest nightly build(http://community.codesmithtools.com/nightly/NetTiers/nettiers-2.3-r887.zip). It is very stable and 2.3.1 is a maintenance release. The latest release also contains the patches you are missing for DataAnnotations. To be honest, I haven't used the Validators in quite some time but I have forwarded your thread (http://community.codesmithtools.com/nettiers/f/16/t/12032.aspx) 2 the rest of the .netTiers team who will follow up with you. Could you also add your comments 2 the thread on the community site, this is the best place 2 post. – Blake Niemyjski Jun 17 '11 at 18:43