Our product has two clients, a website and a windows application. Both clients need to share the data access layer because it contains some of our complex business logic that we do not wish to duplicate. Should this layer be exposed as a WCF service, or put into a shared .dll and deployed with both clients? what are the advantages/disadvantages of both?
Asked
Active
Viewed 1,197 times
0
-
You would need a DataAccessLayer project that deals with your database interactions and then a BusinessLogicLayer where all your business logic is written. Now create a WCF service that interacts with your BusinessAccessLayer and returns the needed data. Your website and win app would fetch everything through the WCF layer. Doing so you can rewrite/change the website or win app without any hassel down the line. Also if there is a client who wants to have his own front end but use your business logic then WCF would provide the interface forit – Rajesh Jun 29 '12 at 13:23
1 Answers
1
The first aspect is security: if you have all your code running locally in your web server, and it gets hacked (which has been known to happen...) then the attacker has access to your DB and all the goodies it contains, or contained as would shortly occur afterwards.
If your code is in a web service, then the attacker has a much harder time snooping around your DB.
The disadvantage of course is that web services is a rather slow protocol, if you have a remote service that just you are accessing (ie no need for interoperability) then you should use a faster, more lightweight protocol - a simple RPC, socket or messaging system would be a better choice for the same result.

gbjbaanb
- 51,617
- 12
- 104
- 148
-
we were thinking of using WCF & hosting the service in IIS, so that we can utilize its load balancing capabilities (web farms & such) for scalability (we're anticipating lots of users hitting lots of sites hitting this service) – Steve Goykovich Jun 29 '12 at 13:37
-
lots of users? Look at Casablanca from MS research. Designed to scale and be efficient as possible. – gbjbaanb Jun 30 '12 at 11:03
-
if it doesn't work out fast enough for you (without doubling or tripling your server farm - think of the CO2) then try [WWS](http://msdn.microsoft.com/en-us/magazine/ee335693.aspx) – gbjbaanb Nov 15 '12 at 19:00