RE: UI Validation in NTier

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: chrisckx (chrisckx_at_discussions.microsoft.com)
Date: 06/22/04

  • Next message: Wayne Carlaw: "Implementing FTP with WebRequest"
    Date: Tue, 22 Jun 2004 11:24:02 -0700
    
    

    Piers,
    Have you considered abstracting your business rules in some generic XML format that can the be edited at will for adding/removing rules, but that any tier can read and interpret as needed for their side, be it UI validation or server side validation.
    Good luck,
    Chris.

    "Piers" wrote:

    > Thanks for the reply Luke
    >
    > I was thinking that option 3 would be a one off call to the middle tier, by the web server, for all the rules, which would then be cached. The web server would then dynamically add the rules to the JavaScript of a page. For instance, a control for entering a credit card number would have an associated regular expression validator control. By default the expression set in this validation control would allow any string. However, if the cached rules contain a credit card regular expression, this will be added to validator, as the page is rendered. By retrieving all the rules in one go and caching them on the web server there shouldn't be many round trips.
    >
    > This is dynamic in that it allows rules to be modified or removed. But, unless all controls are rendered with a validator by default (or there is some mechanism to dynamically add a validator), it does not allow new rules to be added. Perhaps a truly generic solution is not possible without considerable processing overhead.
    >
    > As an aside, a fourth option would be a combination of 2 and 3. The risk validation class could also expose some read only properties such as CreditCardRegExp, these could be used to set the validation rules in web form validator controls or windows form event handlers. However, this still needs some hard coded knowledge of which rules apply to which controls. Also any change to the rules requires the rollout of a new assembly.
    >
    > Piers


  • Next message: Wayne Carlaw: "Implementing FTP with WebRequest"

    Relevant Pages

    • Re: Where do business rules belong... OCP and SPs
      ... >business rules belong in the business tier, ... I don't know the reasons. ... it should also be realized in the database tier. ...
      (comp.object)
    • Re: n-Tier development
      ... Validation and business rules... ... You can also implement some "atomic" business rules that concern the entity ... You have a business rule in the MiddleTier ... DB Constraints ...
      (microsoft.public.dotnet.general)
    • Re: Where do business rules belong... OCP and SPs
      ... the applicant name and co-signer's name should be different. ... applicant is assigned to a loans officer and a loans officer manages a ... These are non-deterministic business rules, ... the business tier or perhaps in the presentation tier? ...
      (comp.object)
    • Re: Business rules in stored procs.
      ... > that no business rules should be described by TSQL. ... > rules belong in the middle tier. ... the business rules in the same technology and tier. ... and that stored procedures just tie your ...
      (microsoft.public.sqlserver.programming)
    • Re: Where do business rules belong... OCP and SPs
      ... >>business rules belong in the business tier, ... >>in the stored procedures back to where I think they belong. ...
      (comp.object)