Linq To SQL, WebServices, Websites - Planning for Everything

A few "parts" (WinForms application for exmaple) of my project use the DAL, which I encoded based on L2SQL. I would like to throw some WebApps into the mix, but the problem is that the DAL "offers" much more data than WebApps requires. The way is bigger.

It would be nice if I wrapped the data that websites need in a web service, and instead of a website directly linked to the DAL, it will go through the web service, which in turn will have access to the DAL ?

I feel that this will add a lot of overhead, but on the other hand, I definitely don't like the feeling that WebApps have β€œcapabilities” to access much more data than they really need.

Any input is appreciated. Thank you very much for your help.

+3
source share
4 answers

You can either create web services or add a repository layer that displays only the data that your applications require. The advantage of the repository is that it is a decoupling layer, which simplifies the unit test of your application (by providing a false repository).

If you plan to end up creating different interfaces (say, a web user interface and a WPF or Silverlight interface), then web services make a lot of sense because they provide a common data foundation for creation and can be accessed through tiers.

+2
source

IQueryable, DAL db .

. , Linq to SQL. MVC, WebForms, WinForms, - ..

, , AsQueryable, , .

.

Domain Layer
    Repository Layer (IQueryable)
        Service layer for Web App
            Website
        Service layer for Desktop App
            Desktop App
        Service layer for Web Services 
            Web Service

, . , , , ORM ( - , ORM)

+1

, , . .NET 4 50 , .. 5% . , .

DAL , , DAL. , , .

0

, . , DTO.

  • If the domain model changes, only the mapping in the DTO needs to be changed. You can isolate the consumer application from these changes.
  • Less data cable
  • You can isolate your applications from the DAL implementation.
  • You can provide different services (possibly different DTOs) for different applications if you need to limit which parts of the object model should be represented.
0
source

Source: https://habr.com/ru/post/1753434/


All Articles