If you want to learn about implementing Model View Presenter in ASP.Net, read this

Billy McCafferty has published a very good introduction to the MVP in ASP.Net that dives into the mechanics of a lot of the common idioms in real life enterprise architecture.  I especially liked the example of enforcing user permissions on the view in the presenter class. 


 


I mentioned a week or so back that I will be putting together an article on the Model View Presenter pattern sometime this month because I was getting a fair number of questions about the MVP pattern.  I’m still going to do it (the more the merrier on this topic), but I’m going to largely answer a lot of the specific questions about implementation with “go ready Billy’s article on CodeProject.”  Besides, I don’t do a lot of heavy ASP.Net work anyway.


 


 

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Design Patterns. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://www.dotnetjunkies.com/weblog/tshak/ Tim Shakarian

    This is a decent example although I’m not a fan of the View creating the Presenter. Although it’s rare, you may want to have different Presenters for one View. I like to take the arrow away from View->Presenter and use something like what the WorkItem in the Composite UI Application Block to drive the use case and determine which Views get what Presenters. Nevertheless, it’s great to see the Web Application world maturing.

  • jmiller

    It’s Jean-Paul Boodhoo, so it should be good.

  • http://www.jihohan.com Jiho Han

    MSDN has an article about MVP just published. I haven’t read it yet though to say much about it.
    http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/default.aspx

  • http://blogs.microsoft.co.il/blogs/kim Kim

    I don’t do much ASP.NET, mostly WinForms for UI programming.
    Since .NET 2.0 I have found databinding to be very useful when binding to domain objects or just about any class you have. I have followed your writings on using MVP and Fowlers’ as well. In the writings I’ve come across data is manually set by the presenter through property setters which gives us good separation. But in my scenario I often have lists that I bind to e.g Infragistics grid. That way the presenter is bypassed when the user enters data in the grid and it gets passed into the model through the binding framework. Any pointers to other peoples’ writing is also greatly appreciated.

  • jmiller

    Kim,

    I’m going to have to send you to other resources for that question. I honestly haven’t done any ASP.Net databinding in years, other than really simple DataGrid stuff.

    Dave,

    Can you be more specific? Do you have something in mind? In a WinForms app we moved to a Layer Supertype for all the Presenters, but I’m not sure why you would in ASP.Net unless there is a lot of commonality in your screens.

    Jeremy

  • Dave

    Also be nice to talk about how inheritence affects the pattern. Do you inherit from the View or Presenter (or both).

  • http://blogs.microsoft.co.il/blogs/kim Kim

    I have a wish for a topic in your upcoming article on MVP.
    Since Databinding is becomming a more relevant solution in .NET 2.0 with object binding etc. I would like to see some best practices for using MVP with databinding.