Previously, the company had been using petshop4.0 to streamline the architecture, but the amount of code is relatively large. If you want to change a method parameter, the interface layer, database layer, and logic layer must be closely associated with the change.
But I cannot see the benefits of doing so. I can use the most common Layer 3 (Data + logic + representation). Why must I add an interface and a factory layer?
It can be divided into several layers:
Msoft. Mat .................................... Website
Msoft. Mat. BLL .............................. Logic
Msoft. Mat. dalfactory ..................... Factory reflection
Msoft. Mat. idal .............................. Interface
Msoft. Mat. sqlserverdal .................. Data
Msoft. Mat. dbutility ..................... Database Connection
Msoft. Mat. Model .............................. Entity
The most common Layer 3 is probably the interface and factory layer, because these two layers bring convenience to database transplantation.
For example, if the SQL serser database is used and the database needs to be migrated to the Oracle database, the database layer has an additional layer (as shown below ):
Msoft. Mat .................................... Website
Msoft. Mat. BLL .............................. Logic
Msoft. Mat. dalfactory ..................... Factory reflection
Msoft. Mat. idal .............................. Interface
Msoft. Mat. sqlserverdal .................. Data (SQL)
Msoft. Mat. oracledal .................. Data (Oracle)
Msoft. Mat. dbutility ..................... Database Connection
Msoft. Mat. Model .............................. Entity
Because the Assembly name called by factory reflection is dynamic configuration (generally on the web. config configuration), that is, msoft. mat. sqlserverda and msoft. mat. oracledal is dynamic, and the name of the class to be instantiated is the same as that of the interface. Therefore, you only need to modify the database layer for database transplantation to achieve the effect (of course, the database connection string also needs to be changed)
When we have done a good job in various data layer classes, for example, we plan to port data between sqlserver, Oracle, and MySQL databases, we can define the data class as follows:
Msoft. Mat .................................... Website
Msoft. Mat. BLL .............................. Logic
Msoft. Mat. dalfactory ..................... Factory reflection
Msoft. Mat. idal .............................. Interface
Msoft. Mat. sqlserverdal .................. Data (SQL)
Msoft. Mat. oracledal .................. Data (Oracle)
Msoft. Mat. mysqldal .................. Data (MySQL)
Msoft. Mat. dbutility ..................... Database Connection
Msoft. Mat. Model .............................. Entity
Modify the Assembly name variable in the configuration file (for example, to port to the Oracle database, the variable = "msoft. Mat. oracledal" in webconfig) to achieve database migration.
This is just my own understanding. If something is wrong, I hope you can correct it.
Well, write it here first. I want to resign now! Maybe this is the last few technical blogs. I don't know if I have the chance to write more DOTNET technical blogs in the future.