Los Techies : Blogs about software and anything tech!

ASP.Net MVC Portable Areas – Part 3


Using a Portable Area

This is the third part in a series about using a Portable Area (PA) using MvcContrib.  This sample walks through the Host Application side of consuming the Login Portable area.  This example demonstrates how a portable area such as a login can send messages and recieve responses from the host application.  This allows the host application to control the core of the application and lets the Portable Area solve the User Interface portion of the Login.  While this is a pretty simple example it is important to look at the concept of what a Portable Area could solve.  A portable Area could just handling wiring up multiple user interface screens and deal with simple form validation while leaving a lot of from for the host application to control the parts that are important to the application.  Or a Portable Area could provide an entire self contained piece of functionality like a Blog engine, or mulit-instance forum.  There is a large spectrum for how much the Portable Area could provide.  This example focuses on an example where the Portable Area provides the UI and lets the host application own the domain logic.

 

In order to use a Portable Area (PA), the following references need to be added to your MVC project: MvcContrib & the assembly of the Portable Area.

image

 

Wiring up the Portable Area to the application is done at startup.  Portable Areas use the message bus as a way to communicate between the PA and the application. The main method for integrating with a portable area is to register a Message Handler. The sample below demonstrates wiring up a LogAllMessagesObserver, LoginHandler, and a ForgotPassword Handler for the Login Portable Area. 

The call to the InputBuilder.Bootstrap() is required to initialize the Embedded Resource view engine used by this Portable Area infrastructure.

image

Here is an example of an Observer message handler.  This handler simply logs the message to the debugger. This could be used to collect metrics about the system, or log messages to a loggin framework.  The idea of an observer is that it is looking at the base message and not modifying the state of the message.

image

The Login Message Handler receives the login request and than sets the result object which is part of the contract that is specified by the LoginPortableArea from Part 2.

image

In this example the main logic for login is still in a authentication service.  The handler is just used to wire up the message and response of the portable area to the host applications domain services. 

 

Whats Next?

The constructor of the LoginHandler takes an IAuthenticationService as a dependency and my next post will walk through how an Inversion of Control container can be connected to the Bus to allow the framework of your choice to put your pieces together.

 

 

 

Kick It on DotNetKicks.com
Posted Nov 03 2009, 12:00 PM by erichexter

Comments

Reflective Perspective - Chris Alcock » The Morning Brew #469 wrote Reflective Perspective - Chris Alcock » The Morning Brew #469
on 11-04-2009 3:28 AM

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #469

ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … Scripts Rss wrote ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … Scripts Rss
on 11-04-2009 3:35 AM

Pingback from  ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … Scripts Rss

Webmaster Crap » Blog Archive » ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … wrote Webmaster Crap » Blog Archive » ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …
on 11-04-2009 6:18 AM

Pingback from  Webmaster Crap  » Blog Archive   » ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …

progg.ru wrote ASP.Net MVC Portable Areas – часть 3
on 11-04-2009 9:09 AM

Thank you for submitting this cool story - Trackback from progg.ru

ASP.Net MVC Portable Areas via MvcContrib - Eric Hexter - Los Techies : Blogs about software and anything tech! wrote ASP.Net MVC Portable Areas via MvcContrib - Eric Hexter - Los Techies : Blogs about software and anything tech!
on 11-04-2009 9:27 AM

Pingback from  ASP.Net MVC Portable Areas via MvcContrib - Eric Hexter - Los Techies : Blogs about software and anything tech!

ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … wrote ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …
on 11-04-2009 9:29 AM

Pingback from  ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …

ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies … wrote ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …
on 11-04-2009 9:29 AM

Pingback from  ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies …

ASP.Net MVC Portable Areas ??? Part 2 - Eric Hexter - Los Techies : Blogs about software and anything tech! wrote ASP.Net MVC Portable Areas ??? Part 2 - Eric Hexter - Los Techies : Blogs about software and anything tech!
on 11-04-2009 9:33 AM

Pingback from  ASP.Net MVC Portable Areas ??? Part 2 - Eric Hexter - Los Techies : Blogs about software and anything tech!

Twitter Trackbacks for ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies : Blogs about software and anything tech! [lostechies.com] on Topsy.com wrote Twitter Trackbacks for ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies : Blogs about software and anything tech! [lostechies.com] on Topsy.com
on 11-04-2009 12:17 PM

Pingback from  Twitter Trackbacks for                 ASP.Net MVC Portable Areas ??? Part 3 - Eric Hexter - Los Techies : Blogs about software and anything tech!         [lostechies.com]        on Topsy.com

Eric Hexter wrote ASP.Net MVC Portable Area – Part 4 IoC framework support.
on 11-08-2009 3:14 PM

Part 1 – Introduction Part 2 – Sample Portable Area Part 3 – Using of a Portable Area Part 4 – Using

Craig Shoemaker wrote Podcast: Portable Areas with Jeffrey Palermo and Eric Hexter
on 01-07-2010 4:34 PM

In this episode of the Polymorphic Podcast Eric Hexter ( @ehexter ) and Jeffrey Palermo ( @jeffreypalermo

Podcast: Portable Areas with Jeffrey Palermo and Eric Hexter | I love .NET! wrote Podcast: Portable Areas with Jeffrey Palermo and Eric Hexter | I love .NET!
on 01-07-2010 7:34 PM

Pingback from  Podcast: Portable Areas with Jeffrey Palermo and Eric Hexter | I love .NET!

Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems