Data room fee system cooperation edition (I)-framework construction

Source: Internet
Author: User

In the cooperative version of the data room charging system, the framework is used for the first time: Three Layers + spring. NET + nhibernet framework.


I. Overall framework diagram:



The architecture of the second and third layers is as follows:

Dal layer:

Adapter:

Structure:

Implement irepositorydal interface: Extension
Inherit repositorybasedal parent class: Reuse


Function:

Operation class: encapsulate basic operations-add, delete, modify, and query

This. hibernatetemplate. Save (entity)

This. hibernatetemplate. Delete (entity)

This. hibernatetemplate. Update (entity)

This. hibernatetemplate. saveorupdate (entity)

This. hibernatetemplate. Find <t> ()

This. hibernatetemplate. Get <t> (ID)

This. hibernatetemplate. Load <t> (ID)


Entity:
. CS: entity class
. Xml: ing File

Collection: Collection class

Base. xml:

Inject hibernatetemplate into layer D for basic method call

Inject the adapter of layer D in layer B to call the method under the adapter.


Bll layer:

Structure:


Function:

Business logic:

Base Class: encapsulate the most basic logic

Adapterbase. getbycondition (columnname, columvalue)

Adapterbase. Get (ID)

Adapterbase. Load (ID)

Adapterbase. Save (entity)

Adapterbase. loadall ()

Adapterbase. Update (entity)

Adapterbase. Delete (entity)

Adapterbase. saveorupdate (entity)

Specific Class: Inherit the parent class; Extend your own logical method

<Span style = "font-size: 18px;"> public class addusersbll: genericbasebll <user, usercollection>, iaddusersbll {// <summary> // Add User Information /// </Summary> /// <Param name = "enuser"> </param> Public void adduserinfo (user enuser) {If (base. get (enuser. id. tostring () = NULL) {// Add user base. save (enuser);} else {Throw new argumentnullexception ("this user already exists. Please enter the user name again! ") ;}}</Span>

U I layer:

. Appconfig: Configuration File


Iii. Summary:


After completing the framework with LH, I suddenly felt that writing code alone was actually the simplest thing. After the framework is set up, the entire system is completed by more than half. The rest is the logic part. The logic part can only be written for three or four days at most. The first time I became a group leader, I had trouble with everything. Fortunately, I had some friends with me all the way.


The system is small and the logic is clear. In order to practice, some new things have also been attempted: Jenkins (automatic release, error checking), Zen Road (assigning tasks to team members), and SVN (Version Control ).



Data room fee system cooperation edition (I)-framework construction

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.