The previous article has designed a relatively perfect database, this beginning into the code. The first design of the database script in the database execution, build the database, and then build the project in VS, in order to facilitate understanding and viewing, I designed a very straightforward class name and file name, no namespace prefix.
Using the interface, a total of 8 projects: 7 class libraries and an MVC project, respectively:
Display Layer--MVC Project
Business Logic Layer--access interface IBLL, concrete implementation BLL
Data access Layer--access interface Idal, concrete implementation DAL
Data (model)--datamodel
General Method--common
Warehousing--factory
Storage here is not for the production of business logic layer and data access layer interface, but to store entityframework context objects and some cache management, business logic layer and data Access layer interface production (implementation) work I will give spring.net injection implementation. After the frame is built, the following:
Frame Well, then add the database, add the new item in the DAL (note that the DAL is not datamodel), and select the data--ado.net Entity Data Model:
Take a name, call it Weixinmodel, choose to build from the database, configure the database to connect to the previously generated database, the next step, the final load to edmx, on the edmx right--Add code generation items, select the code: