CodeSmith Community
Your Code. Your Way. Faster!

Where to hook up Validators and Processors in web context?

Latest post 08-07-2007 4:24 AM by SleepyBoBos. 5 replies.
  • 11-08-2006 10:10 AM

    • velum
    • Top 25 Contributor
    • Joined on 07-14-2006
    • Montréal, Qc, Canada
    • Posts 189
    • Points 4,731

    Where to hook up Validators and Processors in web context?

    Hi!

    In Post 10543, Nick wrote: "You may also want to have an Inserting event handler for your DataSource to stitch up entities (but don't validate in there, that should only be done using validation controls in the UI and in the Business Logic Layer)." And in another post, Robert told me to add my custom processors in the Service App_code folder. Now, I am wondering where to hook-up my validators and processors in a web context.

    In post 17117, Robert showed the following code where o is simply an Order object:

        ///calling IsValid or Validate() will trigger the validation to occur. 
        ///Error property is a newline delimeted list of your broken rules.
        if (!o.IsValid)
            lblMessage.Text = o.Error;

     In a web context with aspx pages and code-behind, in what event is it best to place such code?

     Cheers!

    JF 

    • Post Points: 35
  • 11-10-2006 10:06 AM In reply to

    Re: Where to hook up Validators and Processors in web context?

    Hi,

    I personally now use Fowler's Model View Presenter in my web apps, and put my validators in a View class.  So whatever custom processors/validations need to be in use for that view is what is created.

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 11-10-2006 7:35 PM In reply to

    • velum
    • Top 25 Contributor
    • Joined on 07-14-2006
    • Montréal, Qc, Canada
    • Posts 189
    • Points 4,731

    Re: Where to hook up Validators and Processors in web context?

    Hi Robert!

    Where do you instanciate and call your View class? In Page_Load()?   Or maybe I completely misunderstood you.

    Happy Friday!

    JF
     

    • Post Points: 35
  • 11-10-2006 9:15 PM In reply to

    • jcteague
    • Top 25 Contributor
    • Joined on 03-10-2005
    • Austin, Tx
    • Posts 442
    • Points 10,925

    Re: Where to hook up Validators and Processors in web context?

    follow the link to Fowler's site about MVP.  It is a different paradigm for asp.net web sites.

    On 11/10/06, velum <bounce-velum@codesmithsupport.com> wrote:

    Hi Robert!

    Where do you instanciate and call your View class? In Page_Load()?   Or maybe I completely misunderstood you.

    Happy Friday!

    JF
     





    Thanks, John Teague ------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------

    • Post Points: 35
  • 11-13-2006 11:52 PM In reply to

    • velum
    • Top 25 Contributor
    • Joined on 07-14-2006
    • Montréal, Qc, Canada
    • Posts 189
    • Points 4,731

    Re: Where to hook up Validators and Processors in web context?

    Hi John and Robert!

    Ok, I'll have a deeper look into those links, although it looks a bit complicated relatively to what I am trying to achieve. And, note that on the page about the MVP, Martin Fowler is now saying the folllowing:

    Upon further study and reflection, I decided that pattern that was here under the name "Model View Presenter" needed to be split, so I have seperated[sic] it into Supervising Controller and Passive View. You can find a discussion of the origins of Model-View-Presenter in the context of UI architecutres[sic] here.

    JF


     

    • Post Points: 35
  • 08-07-2007 4:24 AM In reply to

    Re: Where to hook up Validators and Processors in web context?

    All FYI this now appears to be the most up to date link

    http://www.codeproject.com/aspnet/ModelViewPresenter.asp

    • Post Points: 5
Page 1 of 1 (6 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems