這次將完成最後一個自定義屬性功能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; }
}
}
}