William's profileBill PierceBlogLists Tools Help

Blog


    8/14/2006

    MVP Framework

    Lately between baby feedings, baby burpings, baby sittings, baby sleepings, baby poopings, baby peeings, baby playing, and baby photo shoots I've been working an an MVP Framework for ASP.Net 2.0.  My Framework is more along the lines of Martin Fowler's Supervising Presenter.

    I am putting together something I think will be very useful for quickly creating highly dynamic and configurable web applications.  The framework relies on the Windsor Container from the Castle Project.  The Web framework does all the MVP plumbing for you.  All you need to do is create a small Web Project with a single Page to act as the generic host for UserControls/Server Controls.  Then you create your Models, Presenters, and Views and the framework will hook everything together using Dependency Injection.  

    So far it has been a lot of fun and I have been digging deeply into the Castle MicroKernel and the Windsor container.  Specifically creating some custom contributors to allow UserControls to be added, configured, and resolved by the Container.  So far the Framework is 36 KB and it's toight like toiger.

    I borrowed heavily from MonoRail, also part of the Castle project.  I love the concept of MonoRail but I think it is too big of a jump for most ASP.Net developers.  I'm hoping my MVP Framework can be a happy medium between the two-tier DataSet ASP.Net approach and the full on MVC approach in MonoRail.

    The "Views" are simply pre-compiled UserControls or custom Server controls.  The Presenters encapsulate all the business logic and Service interaction.  You can see the simple Interfaces for these two portions of the Framework below.  I want to do some finishing touches and put together an example before I release anything, but I will keep you all posted.  I'll be posting regularly in the next few days explaining why MVP and why my Framework is beneficial.

    using System;

    namespace WCPierce.MVP.Framework

    {

     public interface IPresenter

     {

       IView View { get; }

       void Initialize(bool isFirstCall);

     }

    }

    using System;
     
    namespace WCPierce.MVP.Framework
    {
      public interface IView
      {
        void SetPresenter(IPresenter presenter);
     
        void Initialize(bool isFirstCall);
      }
    }

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Picture of Anonymous
    Mike Nichols wrote:
    Hi Bill...anxious to see how you build this framework. I am stoked about digging into MVP lately and have been checking out the DI containers (per your recommendation :).
    I am trying to find if Castle Windsor can handle attributes out of the box or if you have to write some kind of interpreter to handle attributes. Where are you finding docs that have examples? Also, I want to do some decorated generic implementations (like Resolve<Thing<IDecoratedThing>>()...I see Ayende has some stuff like that but hasn't been brought into the fold completely...what have you found with this (if at all)?
    BTW...I too am constantly dealing with baby [insert baby thing here]...ours is 2 months. Congrads to you :)

    MIKE
    Aug. 16

    Trackbacks (2)

    The trackback URL for this entry is:
    http://wcpierce.spaces.live.com/blog/cns!676A55AA5C4FB1BE!243.trak
    Weblogs that reference this entry