Microsoft. NET Pet Shop 4.0Study Tour (4)
Layer-7 ArchitectureSource code
Today Pet Shop 4.0 Core layer-7 SourceCode. Including: Model Entity layer, Dbutility Data Access abstract class, Idal Data access interface layer, Sqlserverdal Data access layer, Dalfactory Data Access factory, Bll Business logic layer, UI Interface layer.
After thinking about it, there is nothing to say. Let's check it out by sending the source code. Only pay attention to the details.
1, 【 App. config ] (The configuration file is in Ui \ ): Name = "loggingdb" Is the database connection keyword. Key = "assemblydal" YesProgramSet keywords (that is, the prefix of the last generated file name, for example: Petshop4.sqlserverdal. dll ). Key = "namespacedal" It is the default namespace keyword of the program and corresponds to the property settings of the project.
2, 【 Demo. SQL ]: Install this script before running the program. This script creates a table ( Demo ) , Demonstrate complete database addition, deletion, modification, query, and operations. This table includes the four most basic field types ( Int , Varchar , Decimal , Datetime ).
3, 【 UI Interface Layer: Interface Layer UI Only need to reference Model And Bll . But there will be another special reference below ( In red reference ) .
4, 【 Petshop4.sqlserverdal. dll ]: Note: This file is very interesting, because the factory class will load this assembly, Sqlserverdal The data access layer is not referenced by any layer (SEE ). UI Running folder ( \ UI \ bin \ debug ) Will not appear below Petshop4.sqlserverdal. dll . In this way, an error will be reported if the factory class fails to load the assembly! So I UI Intentionally Add a reference Sqlserverdal (Only to generate an assembly File Petshop4.sqlserverdal. dll ).
5,Summarize the above analysis to obtain the complete layer-7 structure diagram (10Relationship,1Special references ):
6,Source code implementationNManagement System Model of small and medium enterprises. This includes basic addition, deletion, modification, and query methods. We will continue to develop basic functional modules for enterprise applications on this platform next time.
7, Source code
Note! In blogCommunityOther than reprinted, must note:
By Clark Chan
And Source: http://clarkchan.cnblogs.com/
Otherwise, reprint is declined!
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////