tags:

views:

12

answers:

2

I am new to WCF but have been working on asmx services for a while.

We have an effort underway where we want to introduce a service layer between our UI/aspx pages and Database Layer. Most of the business logic exists in codebehind. So the current setup is UI/aspx->DAL->Database. We want to do UI/aspx.vb->WCF->Business Layer->DAL->Database i.e by moving everything from codebehind in WCF...Is this a good approach?

Our future goal is to get the flexbility in replacing business layer, so there is no dependency between UI and business layer or database.

Need some guidance on how we can use WCF in right way to do layered architecture approach..

Your help is much appreciated.

Thanks.

A: 

In principle service layers are a good idea but if you're simply introducing one for the sake of it then it's a lot of effort for no return.

The main benefit you will get from a service layer is that you will have a lot more flexibility in the type of clients you can connect to it. At the moment it's likely that the only application that can use your DAL is your ASP.Net app by adding a service layer and exposing it using WCF end points you'll have the option of connecting other SOAP or REST clients which is a good thing for future enhancement.

However if you're only ever planning on using your DAL with your existing ASP.Net app then there's no guarantee that you will gain anything and in fact could make your life harder by adding a service layer. If you do all your data retrieval server-side, i.e. don't use AJAX, then a service layer would be pretty pointless.

sipwiz
A: 

Thanks for the insight. Much appreciated.

Our plan is to expose the service layer so in future we have flexibility of either different clients connecting to business layer or entire new business layer replacing the existing one. And you are right that at moment asp.net is the only app that uses DAL.

Could you provide some insight in to approach of using WCF as service layer in this situation? Thanks.

deviner