How to build a good service layer in ASP.NET?

Posted by Swippen on Programmers See other posts from Programmers or by Swippen
Published on 2012-03-29T09:05:15Z Indexed on 2012/03/29 17:41 UTC
Read the original article Hit count: 211

Filed under:
|
|

I have looked through some questions, technologies for building a good service layer but I have some questions regarding this that I need help with.

First some information of what I have for requirements. We currently have a number of web applications that talk to each other in a spiderweb looking way (all talking to each other in a confusing way via webservices and database data).

  • We want to change this so that all applications go through a service layer where we can work more with cache and encapsulate common functionality and more.
  • We want this layer to also have a Web API so that 3rd party clients can consume information from the service.

The problem I see is that if we build the service layer with say MVC4 Web API don't we need to communicate between the application using the webAPI meaning we have to construct URLs and consume JSON/Xml. That does not sound too effective. I assume a better method would be working with entities and WCF to communicate between the application but then we might loose the Web API magic?

So the question is if there is a way to consume a service layer as both a Web API (JSON/XML) and as a more backend service layer with entities. If we are forced to use 2 different service layers we might have to duplicate some functionality and other bad things.

Hope the question is clear enough and please ask if you need any more information.

© Programmers or respective owner

Related posts about asp.net-mvc

Related posts about wcf