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