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);
}
}
posted @ Friday, August 18, 2006 4:47 PM