Moon ignores the design ideas of Linq and object classes. (Don't miss it. After reading it, we will not envy linq to entiy any more !)

Source: Internet
Author: User

In. net 4.0, the dynamic type is provided for us. It can be a smart type, so we can generate an object class at runtime, then generate a method to obtain the set, and finally call it dynamically.

There is no more simple access method than this. You can try it by yourself. first look at the code, so that we will no longer envy linq to entiy.

 

QQ Group technical exchange:

225656797

 

Let's look at Moon's design.

 

1. Database (sqlite)

 

Create table [Person] (
[Name] NVARCHAR (100 ),
[Sex] BOOL,
[Age] INTEGER,
[Birth] DATETIME,
[ID] integer primary key autoincrement );

 

 

 

 

2. How to obtain data.

 

/*
* Created by SharpDevelop.
* User: qinshichuan
* Date: 2012-12-22
* Time:
*
* To change this template, Click Tools | options | code writing | edit standard header files
*/
Using System;
Using Moon. Orm;
Namespace Moon
{
Class Program
{
Public static void Main (string [] args)
{
Var SQL = "select * from Person ";
Var list = DBFactory. GetAutoEntities (SQL, "Per ");
Foreach (var a in list ){
Console. WriteLine (a. Age plus 100 );
}
Console. Write ("Press any key to continue ...");
Console. ReadKey (true );
}
}
}

 

 

 

3. Download the program instance.

/Files/humble/Moon.zip

 

Other types of databases: how to configure configuration files such as mysql sqlserver (mssql)

Http://www.cnblogs.com/humble/archive/2012/04/08/2437752.html

 

Moon. orm's most comprehensive series

Http://www.cnblogs.com/humble/archive/2012/12/12/2814040.html

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.