Step by step, teach you how to use the agileeas. net base class library for application development-basics-demonstrate basic operations of ORM

Source: Internet
Author: User
System Review

Previous FourArticleI have introduced agileeas in detail. the usage of the Unified Data Access (UDA) component in the. NET platform analyzes the advantages and disadvantages of the two data processing flows, as well as the commissioned execution and transaction processing methods based on the lazy mode, it covers the technical points of business systems supported by databases.

Starting from this article, I will introduce you to agileeas. in the Application cases of the orm Component of the. NET platform, the application of the orm implements the same functions as the previous case, and there is a reference to agileeas. for more information about the. NET platform ORM components, see agileeas.. NET data relationship ORM ing orm and agileeas.. net.

Development Process

I. agileeas. the first step of ORM application development on the net platform is the design of data objects, that is, the definition of the ORM objects involved in the planning, and the databases involved, whether to use a series of policies, such as the interface-driven data layer, in agileeas. NET platform provides a data object designer. The essence of this step is to use the object designer to define data entities:

Ii. GenerateCodeIn this step, use the object designer to generate the data layer code of the currently designed model, or generate the trusted data layer code based on the current object model definition file:

3. process The ORM accessors. The ORM in the agileeas. NET platform is isolated from the operations.ProgramTo use the orm entity to manipulate the database, you must configure the ORM accesser and use the ORM accesser. operation (entity) or entity. orm accessors/entities. operations () Implement ORM operations.

4. Orm operations: After configuring the ORM accessors, you can use the ORM accessors. operation (entity) or entity. orm accessors + entities. operations () to complete orm and database operations.

Case studies

The Demo code database structure in this article is based on step-by-step instructions for using agileeas.. Net basic library for application development-basics-definitions in the data definition section. In this case, the steps for designing the object model are also omitted. We directly use the demo provided above. the SDM file generates code and is sure not to generate the data interface layer code:

The business function completed in this case is to read all the data in the commodity dictionary, and the instance shows how to add, read, repair, and delete a new commodity dictionary record. The project structure is as follows:

In the demo solution, classlibdemo. Dal. sqlserver is a project generated by the generator, and classlib. ormdemo is a control platform project. The process control code is as follows:

Static void main (string [] ARGs) {system. console. writeline ("agileeas.. NET platform ORM Component example, press any key to start... "); system. console. read (); system. console. writeline ("example of Reading full table data:"); New tabledemo (). demoquery (); system. console. writeline ("press any key to continue... "); system. console. read (); system. console. writeline ("example of Data Query:"); New dataobjectdemo (). demoquery (); system. console. writeline ("press any key to continue... "); system. console. read (); system. Console. writeline ("example of data insertion:"); New dataobjectdemo (). demoinsert (); New dataobjectdemo (). demoquery (); system. console. writeline ("press any key to continue... "); system. console. read (); system. console. writeline ("demo data update example:"); New dataobjectdemo (). demoupdate (); New dataobjectdemo (). demoquery (); system. console. writeline ("press any key to continue... "); system. console. read (); system. console. writeline ("example of data deletion (delete):"); n EW dataobjectdemo (). demodelete (); New dataobjectdemo (). demoquery (); system. Console. writeline ("press any key to end. "); System. Console. Read ();}

The program running result is as follows:

For the structure of the data table involved in this example, refer to the data table structure based on agileeas. NET platform basic library for application development-General description and data definition, for data object model definition files, documents, DDL scripts download: Workshop.

 

Link

Step by step teach you how to use the agileeas. net base class library for application development-series directory

Agileeas. NET platform development guide-series Directories

Introduction to agileeas. NET application development platform-Index

Agileeas. NET platform application development tutorial-case plan

Official website of agileeas. net

Agile Software Engineering Lab

QQ: 116773358

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.