using
System;
using System.Collections.Generic;
using System.Text;
namespace Common
{
[AttributeUsage(AttributeTargets.Class)]
public class TableAttribute : Attribute
{
private string m_name;
private string m_keys;
public TableAttribute( string name, string primaryKeys)
{
this .m_name = name;
this .m_keys = primaryKeys;
}
public string Name
{
get { return m_name; }
set { m_name = value; }
}
public string PrimaryKeys
{
get { return m_keys; }
set { m_keys = value; }
}
}
}
ColumnAttribute.cs
using System.Collections.Generic;
using System.Text;
namespace Common
{
[AttributeUsage(AttributeTargets.Class)]
public class TableAttribute : Attribute
{
private string m_name;
private string m_keys;
public TableAttribute( string name, string primaryKeys)
{
this .m_name = name;
this .m_keys = primaryKeys;
}
public string Name
{
get { return m_name; }
set { m_name = value; }
}
public string PrimaryKeys
{
get { return m_keys; }
set { m_keys = value; }
}
}
}
using
System;
namespace Common
{
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
private string name;
public ColumnAttribute( string name)
{
this .name = name;
}
public string Name
{
get { return name; }
set { name = value; }
}
}
}
User.cs
namespace Common
{
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
private string name;
public ColumnAttribute( string name)
{
this .name = name;
}
public string Name
{
get { return name; }
set { name = value; }
}
}
}
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common
{
[Table( " T_Bas_User " , " Id " )]
public class User
{
private int id;
private string name;
private bool isAdmin;
private decimal salary;
private DateTime birthday;
[Column( " Id " )]
public int Id
{
get { return this .id; }
set { this .id = value; }
}
[Column( " FullName " )]
public string Name
{
get { return this .name; }
set { this .name = value; }
}
[Column( " IsAdmin " )]
public bool IsAdmin
{
get { return this .isAdmin; }
set { this .isAdmin = value; }
}
[Column( " Salary " )]
public Decimal Salary
{
get { return this .salary; }
set { this .salary = value; }
}
[Column( " Birthday " )]
public DateTime Birthday
{
get { return this .birthday; }
set { this .birthday = value; }
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common
{
[Table( " T_Bas_User " , " Id " )]
public class User
{
private int id;
private string name;
private bool isAdmin;
private decimal salary;
private DateTime birthday;
[Column( " Id " )]
public int Id
{
get { return this .id; }
set { this .id = value; }
}
[Column( " FullName " )]
public string Name
{
get { return this .name; }
set { this .name = value; }
}
[Column( " IsAdmin " )]
public bool IsAdmin
{
get { return this .isAdmin; }
set { this .isAdmin = value; }
}
[Column( " Salary " )]
public Decimal Salary
{
get { return this .salary; }
set { this .salary = value; }
}
[Column( " Birthday " )]
public DateTime Birthday
{
get { return this .birthday; }
set { this .birthday = value; }
}
}
}