11.19(eleven point one nine)




The role of entity in the three-tier architecture:

1. Realize the “encapsulation” in the object-oriented idea; 2. It runs through the three layers and transfers data between the three layers; (Note: specifically, the entity layer runs through the three layers to connect the three layers) 3. For beginners, it can be understood that each data table corresponds to an entity, that is, the fields in each data table correspond to the attributes in the entity (Note: of course, this is not the case. Why? 1 >, the entity we need may not exist in the entity corresponding to the data table; 2 >, we can put all fields in all data tables in one entity) 4. Data transfer between each layer (UI – & gt; Bll – & gt; DAL) (one-way) It is transferred by variables or entities as parameters, which constructs the relationship between the three layers and completes the realization of the function. However, for a large amount of data, it is complicated to use variables as parameters because there are too many parameters, which are easy to be confused. For example, I want to transfer employee information to the lower level, including employee number, name, age, gender, salary If variables are used as parameters, there will be many parameters in our method. It is very possible to confuse parameter matching when using them. At this time, it will be convenient to use entities as parameters without considering the problem of parameter matching. It is convenient to use which attribute in entities directly. This also improves efficiency.