First attach the item that I hosted on GitHub Https://github.com/lichaojacobs/Tomato
The next three-tier structure contains the parent interface, the sub-interface, the parent class, the subclass part
1. Write the data access layer
The data access layer is the operation to change the database's additions and deletions. First, we declare some common methods for uniform processing of databases in the parent interface of the data access layer:
View Code
Then there is the business Layer sub-interface (the model in your data entity model, below the model in my project, for reference only), and let it inherit from the business Layer parent interface
View Code
Finish writing the interface, then write the parent interface's implementation parent class BaseDAL.cs
View Code
Note that here is a tool class (Dbcontextfactory) to obtain the context object of the data entity, through which the tool class can share the context object in a thread
View Code
2. Building the business Logic layer
This process is similar to the data access layer (the business layer calls the data access layer related methods), not much to say, directly on the code
Business Parent interface (the declaration of a method is the same as the data Access Layer parent interface):
View Code
Business sub-Interface
View Code
To implement the parent class and the child class:
View Code
View Code
3, the expression layer of the simple call:
Ibll. IT001 Account table BLL user=new BLL. T001 Account table BLL ();
User. Getlistby (m = M.email = = "");//lambda expression
Note: limited to length and time, now away from the spring.net and the Factory mode is still very remote, I will continue to update, interested in the project on GitHub, has achieved control reversal and Factory mode
spring.net+ three-tier architecture (update) built to implement Factory mode in ASP.