WCF RIA Services, WCF RIA Services toolkit, Entity Framework in n-tier Architecture 

Friday, August 5, 2011 1:00 PM

When I started building out OliveLite, I did not pay much attention to the layering of the application. The vision was narrow, I wanted to get a plugin based MVC 3 application infrastructure in place, that could be extended by dropping dlls of plugins built in separate projects into the bin folder of the Core and they would ‘just work’. While that in itself is a pretty solid architecture to achieve, it did not consider the aspect of sharing the business logic built in the controllers of the MVC 3 application with other clients (e.g. Mobile applications). Now I need to revisit the layering of the application and make the controllers lean and mean and push the business logic to a layer in its own so that it can be shared across various clients.

While attaining that goal, I did not simply want to build a SOAP/XML web service (I have done that a lot many times in the past and very well know their limitations). I wanted to have something that made sense from an infrastructure perspective, like sharing the authentication mechanism for instance. I started thinking along the lines of Silverlight 4 & WCF RIA Services. I was intrigued by the way the DomainService reflected on the client side and Silverlight could just make calls to the client proxy of the DomainService. But that was all made possible by the Silverlight infrastructure and there was no easy way to make that same thing happen in ASP.NET MVC 3. So I left the issue on the back burner for a while (and the work on OliveLite suffered as well because I was not prepared to write any more code unless I had ironed out the issue).

Recently the urge to make progress on OliveLite made me look into this again. During my research on the subject I came across a great series by David Rousset, How to open a WCF RIA Services application to other type of clients. The key ingredient that comes to light is the WCF RIA Services toolkit. This series demonstrates how one could use the WCF RIA Services to build a Business Logic Layer that can be shared with various client. The Entity Framework provides the Data Access Layer (which is already employed by OliveLite) and so now the ASP.NET MVC 3 application can be very lean and mean (and of-course easy to upgrade when MVC 4 comes along). So finally we have:

  1. ASP.NET MVC 3 – Presentation Layer
  2. WCF RIA Services / WCF RIA Services Toolkit – Business Logic Layer
  3. Entity Framework – Data Access Layer

It does get very clean and easy. Now all that remains is the time to push all that business logic built into the controllers to the WCF RIA Services (and that is the hard part).

Share This Using Popular Bookmarking Services
Comments are closed on this post.