Home > Net > C # code communication generally on the layer?
C # code communication generally on the layer?
Time:09-22
I wrote a class, for example, contains the communication connection, disconnection, read and write data function, should be on which layer?
CodePudding user response:
Mainly the BLL layer, it calls the DAL to access the database to add and delete, and business related communications (such as asking the cluster in which a machine that can handle "Word document version than") operating nature is strange the BLL function,, of course, the key is to see to what extent are you enclosed, if you are just the underlying API, so in order to develop the efficiency for the purpose of, you also need to be a high level of encapsulation,
The way, don't worry about "three layers" concept, because you may only be able to look from bottom to up at this time, when you understand the three layers are often about concept by mistake, you jumped out of the barriers, bottom hole, in the three layers, from the management point of view rather than from the technical point of view, would be completely different,
CodePudding user response:
In addition to pay attention to, "in which layer" the request itself is wrong, actually the BLL depend on your communication library, rather than the communication library as what the BLL layer code,
CodePudding user response:
Why the layered? Because want whole replaced with another implementation, so need to isolate If your communication logic is need to be replaced, such as today with socket, with a websocket tomorrow, so need to separate layers, or who calls, who is in there,