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,

CodePudding user response:

reference 1st floor interacting in a professional developer response:
is mainly the BLL layer, it calls the DAL to access the database to add, 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,


Oh, but I this class does not contain any logic, just some simple data acquisition function (for example, send a read), and then call to obtain the results in other places for processing, then is also on the BLL layer?

CodePudding user response:

Guiyang
reference 3 floor old Ma Shanfu plugging waterproof engineering professional maintenance of swimming pool response:
why? 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,


See, that if the logic needs to change to this to where?

CodePudding user response:

refer to fifth floor gdut march response:
Quote: refer to the third floor of guiyang horse Ma Shanfu plugging waterproof engineering professional maintenance of swimming pool 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,


See, that if the logic needs to change to this to where?

Separate layer

CodePudding user response:

Layer is not to say that change is required, but said, will it change layers are needed and the rest of the separation, this is clear

CodePudding user response:

Mitsubishi FX PLC debugging assistant
https://download.csdn.net/download/wang420520/12112068
  •  Tags:  
  • C#
  • Related