这次将完成最后一个自定义属性功能Column,在讲Column实现之前先看看Student表的结构 如下:
create table student
(
studentid VARCHAR2(40),
studentno VARCHAR2(40),
name VARCHAR2(40),
address VARCHAR2(40),
telphone VARCHAR2(40)
)
然后来看看Column自定义属性的具体用法代码1-1:
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.Orm.CustomAttributes;
namespace Entity
{
[Serializable]
[Table(Name="Student")]
public class StudentEntity
{
private string stuid;
private string stuno;
private string name;
private int sex;
private int age;
private string address;
private string telphone;
[Id(Name=”studentid”,Strategy = GenerationType.INDENTITY)]
public string Stuid
{
get { return stuid; }
set { stuid = value; }
}
[Column(Name="studentno")]
public string Stuno
{
get { return stuno; }
set { stuno = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
[Column(IsInsert = false,IsUpdate = false)]
public int Sex
{
get { return sex; }
set { sex = value; }
}
[Column(IsInsert = false, IsUpdate = false)]
public int Age
{
get { return age; }
set { age = value; }
}
public string Address
{
get { return address; }
set { address = value; }
}
public string Telphone
{
get { return telphone; }
set { telphone = value; }
}
}
}