Why use a web service with Linq to SQL?

Can someone tell me what is the need / benefit of using a web service with gui asp.net and using Linq to SQL? The web service layer seems unnecessary. Linq to SQL is completely new to me, and I am learning it by creating a new project. Does anyone have experience with this?

+4
source share
5 answers

You will provide services for cases where other applications may require access to your data (for example, a smart client, another application, winforms application, etc.). Many people will evolve using web services so as not to allow themselves to restructure web services in the future.

In almost any professional / corporate web application, you want to separate the user interface layer from the data access layer so that you do not embed LINQ in SQL queries at the user interface level. Instead, you will have a level of service between them, whether it's its web services, WCF, or just a DLL with business logic that organizes your level of data access. Independent levels are easier to maintain, update, refactor, and learn, so upfront investments in their creation are worthy of attention.

+6
source

This is certainly not necessary, but it can be convenient if you want to keep the level of data access on a separate server from your presentation server (ASP.NET). The web service allows you to restrict communication between two servers only to port 80.

Please note that this may apply to regular old ADO.NET or anything else.

+3
source

Web services became a separation layer because they were intended as an agnostic way of sending data to other software. These are websites that serve information for other software, and not directly to the user.
Web service is a redesigned separation layer for a website and cannot completely replace good data, business logic, and user interface separation.
Do it as your logic says, but beware of the performance degradation you pay if you don't need to communicate with other software.

+2
source

I completely agree with Ovidiu Pacurar. Web services are NOT a good choice for modeling layers of concern. You have to do this using a good old fashioned OO design. There is no reason for a web application to call web services internally to access data if it is not intended for ajax client calls, or if you need to run the business / data layer on another server for extreme security.

+2
source

Agreed with the previous poster. You will probably want to do this in order to apply the “Separation of problems” idea ...

0
source

All Articles