Mysoft. Data

Source: Internet
Author: User

1. Description of mysoft. Data

1. Introduction

Mysoft is a small open-source framework, including Orm, Ajax, MVC, net, and Web. Mysoft. Data is the orm framework. Supports multiple different databases, such as sqlserver, Oracle, MySQL, SQLite, Firebird, and access. Mysoft. Data is a lightweight ORM framework that can replace SQL statements.

Ii. Steps for using mysoft. Data

A) install setupentityvsplugin.

Double-click setupentityvsplugin to install the plug-in to the corresponding directory. If you use vs2005 to modify the setupentityvsplugin.exe file, set the configuration items addinversionname and addinversionno to the correct data

B) generate the object file mysoft. Tools. entitydesign

Use mysoft. Tools. entitydesign to generate an object file.

1. Select the database to use: sqlserver, sqlserver2005 ,,,

2. Set the correct database link string

3. Click "Connect server" to display the tables and views in the database in the box on the left.

4. Select the table or view for which an object is to be generated

5. Click "select folder" to select the path of the object to be stored.

6. Click "generate object interface" to generate an object file and display the Interface Class in the text box.

7. Click "generate multiple files" to generate real object files.

Note: The preceding steps are used to generate an object interface. In the solution, create a new project file and add the generated object file to the project. It is best to store only object interface classes in this project file. descriptive comments on objects are all operated in the interface file.

C) entitydesignconifg. xml configuration file

1. Add the entitydesignconifg. xml file to the project of the object interface class.

2. modify configuration items as needed

3. compilemode: indicates the compiling mode.

4. inputdllname: indicates the DLL file name of the input object interface class, that is, the DLL file name generated by the project.

5. outputlanguage: language of the output object class. The default value is C #

6. outputnamespace: The namespace of the output object class

7. entitycodepath: indicates the path of the output object class file, that is, the path for generating and storing the object class generated by the object interface class.

D) generate an object file

After completing the preceding steps, compile the object interface project to generate an object class. Add the generated object class to the corresponding project.

E) WriteCode

Write code in the corresponding project to directly reference the generated entity. Note the namespace.

Iii. Simple Description of mysoft. Data Code

A) dbsession

Dbsession is the database operation session object of mysoft. data. It is the entrance to all database operations.

Instantiation:

1. database for dbsession operation

Dbsession = new dbsession (New mysoft. Data. sqlserver9.sqlserver9provider ("database connection string "));

2. Use dbsession to operate the default database

Dbsession = new dbsession (mysoft. Data. providerfactory. Default );

3. From <> query function

Dbsession. From <entity Class Name> ()

1. Count: number of records returned

2. distinct: Return unique data

3. groupby: Group

4. Having: grouping Conditions

5. orderby: Sorting

6. Select: select certain fields.

7. Where: Add query Conditions

8. toreader: returns isourcereader

9. totable: Return isourcetable

10. tolist: Return isourcelist

11. tolist <>: Return isourcelist of the specified type.

4. Delete <> delete function

Dbsession. Delete <Object Class Name> (New whereclip ("condition "))

5. Update <> UPDATE function

Dbsession. Update <entity Class Name> (field parameter group, value parameter group, new whereclip ("condition "))

6. Save <> insert Function

Dbsession. Save <entity Class Name> (entity instance)

7. Insert <> insert Function

Dbsession. Insert <Object Class Name> (field parameter group, value parameter group)

8. exists <> check whether the function exists.

Dbsession. exists <entity Class Name> (New whereclip ("condition "))

9. Single <> get data Function

Dbsession. Single <entity Class Name> (New whereclip ("condition "))

10. Count <> count function

Dbsession. Count <entity Class Name> (New whereclip ("condition "))

11. max <> maximum statistics function

Dbsession. max <entity Class Name> (entity field, new whereclip ("condition "))

12. Min <> minimum statistical function

Dbsession. Min <entity Class Name> (entity field, new whereclip ("condition "))

13. AVG <> average statistics function

Dbsession. AVG <entity Class Name> (entity field, new whereclip ("condition "))

14. Sum <> statistical summary Function

Dbsession. Min <entity Class Name> (entity field, new whereclip ("condition "))

B) dbbatch

Perform operations in batches

Dbbatch batch = dbsession. beginbatch ();

1. Delete batch. Delete <stockconfig>.

2. Insert batch. Insert <stockconfig>.

3. Update batch. Update <stockconfig>

4. Insert batch. Save <stockconfig>

5. The actual execution of batch. Process () Operations

Note: This operation only applies to the same operation in batches. Delete, insert, update, and save operations only identify the operation. Only the process is actually executed.

C) dbhelper

Perform DB operations

Dbhelper helper = new dbhelper ("connection string", providerfactory. Default );

D) dbtrans

Transactions

Dbtrans TRAN = dbsession. begintrans ();

Other operations are the same as the built-in transaction operations of Vs, but the operation data is operated by Tran.

E) providerfactory

Database provider Factory

Providerfactory. Default

Providerfactory. createdbprovider

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.