spring.net+ three-tier architecture (update) built to implement Factory mode in ASP.

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.