views:

94

answers:

1

Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI tier into separate physical layers.

What is the best/easiest strategy to move serialized objects between the service tier and the UI tier?

I was considering serializing POCOs into JSON using simple ASP.net pages to serve the middle tier. Meaning that the UI/Web tier will request data from a (hidden to the outside user) web server that will return a JSON string. This kind of JSON 'emitter' seems easily testable. It also seems easily compressible for efficiently moving data over the WAN between tiers.

IIS Asp.net UI webforms
    ^
    ^
-- WAN --
    ^
    ^
IIS Asp.net webforms
 to generate JSON
    ^
SQL Server

I know that some folks use .asmx webservices for this kind of task, but this seems like there is excess overhead with SOAP, and the package is not as human readable (testable) as POCOs serialized as JSON. Others are using more complex technology like WCF which we have never used.

Does anyone have advice for choosing a method for moving data/objects between the data (db) tier and the web (UI) tier over the WAN using .net technologies?

Thanks!!!

+2  A: 

Sounds like you want a REST API. ASP.NET MVC Controllers will do the trick.

mcabral
In this case is a 'view' still used, or does the controller send the JSON directly? Or does the view emit the the JSON directly?
Pete Lunenfeld
Controllers can directly return objects and collections, without rendering a view :)
mcabral