日期:2014-05-20 浏览次数:20982 次
--用户类 表脚本创建 for SQL SERVER
Create Table TB_User
(
ID int identity(1,1) primary key,
Name varchar(50) not null,
Birthday datetime
);
/*
本类由PWMIS 实体类生成工具(Ver 1.1)自动生成
http://www.pwmis.com/sqlmap
使用前请先在项目工程中引用 PWMIS.Core.dll
2010-2-26 17:45:06
*/
using System;
using PWMIS.DataMap.Entity;
namespace MyNameSpace
{
[Serializable()]
public partial class User : Entity
{
public User()
{
TableName = "tb_user";
//IdentityName = "标识字段名";
IdentityName="ID";
//PrimaryKeys.Add("主键字段名");
PrimaryKeys.Add("ID");
AddProperty("ID", default(System.Int32));
AddProperty("Name", default(System.String));
AddProperty("Birthday", default(System.DateTime));
}
public System.Int32 ID
{
get{return (System.Int32)getProperty("ID");}
set{setProperty("ID",value );}
}
public System.String Name
{
get{return (System.String)getProperty("Name");}
set{setProperty("Name",value ,50);}
}
public System.DateTime Birthday
{
get{return (System.DateTime)getProperty("Birthday");}
set{setProperty("Birthday",value );}
}
}
}
Console.WriteLine("rn实体对象持久化测试:");
User zhang_san = new User();
//zhang_san.Uid = 5;
EntityQuery<User> query = new EntityQuery<User>(zhang_san,true );
zhang_san.Name = "张三1";
query.Save();// 新增
Console.WriteLine("新增实体对象OK");
zhang_san.Birthday = new DateTime (1977,3,10);
query.Save();// 修改
Console.WriteLine("修改实体对象OK");
this.txtOQL.Text = "";
User u = new User();
OQL q = new OQL(u);
q.Select().Where(q.Condition.IN(u.Uid, new object []{1,3,5}));