.net - Validation Application Block Questions -


Has anyone used the application block recognition from the Enterprise Library? Any success?

Anyway, my question is regarding validating a numerical unique identifier, say that I have a product class, in which there is a feature of the product that represents the product's unique identifier. It is numerical, this identifier can not be less than 1, it should be greater than 1. Which verification type I do not select to use the recognition application block I was thinking of trying the range type, but it needs 2 values, low and upper values.

Another question to validate business object properties. Is this the best way to check business items? I just want to specify the validity rules once, then I want to use them in different layers of ASP.NET. I have never accepted merchandise in this way, just on the client side. Can anyone tell me what is the best way to go along and if I am in the right direction?

Can someone give advice?

Thank you Brandon

VAB experience

For VAB has used in projects. I would say that this is good. I will not say so far that it is great. There is no big problem till now. What have I found that we needed to make some customs valid because our needs were not addressed outside of the box. So it is not capable of solving our Configuration Tool Our types fine which is good (I think it's problems with a bug) to load dependency This code runs fine but we There was a few configurations without tools.

to validate a numeric unique identifier

Are you aware that on the right track with the range validator that consists of three different types in each category (upper and lower): inclusive Exclusive and Ignore. It should cover most cases In your case, you can specify the upper bound that Ignore the lower limit as 1 inclusive (assuming you want the product ID to be 1 or more).

The configuration will look like this:

& lt; Properties & gt; & Lt; Property Name = "Product ID" & gt; & Lt; Manyk Lower Bound = "1" Niclabaund type = "inclusive" Ignore upper bound = "0" type upper bound = "" Nkarit = "false" Sndeshmetlet = "Oh ... is very low." MessageTemplateResourceName = "" MessageTemplateResourceType = "" tag = "" type = "Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeValidator, Microsoft.Practices.EnterpriseLibrary.Validation, Version = 4.1.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35" name = "Range recognizer" /> & Lt; / Property & gt; & Lt; / Properties & gt;

Validate Business Object Properties

It looks like you are on the right track. You must always validate the input at your business (or service level) level. If you also want to verify at the client level, you can share your configuration or entities (business objects that you have called them), but You have to make sure that configs or institutions are synchronized between the theaters, to consider another thing, whether you have two different sources Are valid for levels that will display validation results. WEB is integration with ASPNAT, but once you make a business-level call you will not have that integration, so you will need another (custom) way to display those errors. (This can be as simple as a label to dump errors.)

Now you are saying: Ah, but if I recognized in our class all validation errors me in ASP .NET and it all works well together. truth. But it brings me to my last point.

VAB may be able to handle all assumptions, but it will probably not be able to handle complex assumptions. If you have cross field (or cross object) validations then VAB is not going to do well Also, you may need some custom verification at your business level that you do not want to execute at the web level (like maybe some Recognition depends on database or external services which are not accessible from the web level). Therefore it is possible that you can perform two different implementations to display verification / error message.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -