using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace Ant.ORM
{
///
/// 引用对象的关系(扩展对象)
///
[AttributeUsage(AttributeTargets.Property)]
public class ReferenceAttribute : Attribute
{
private DbType[] _DataType;
private string[] _ForeignKey;
private string _ForeignTable;
private string _Key;
private string[] _MainKey;
private string _ShowField;
///
/// 扩展对象及关联对象
///
/// 关键字
/// 主表
/// 外键所在的表
/// 主表主键
/// 外键关联的字段
/// 数据类型
/// 显示字段
public ReferenceAttribute(string key, string foreignTable, string[] mainKey, string[] foreignKey, DbType[] dataType, string showField)
{
this._Key = key;
this._ForeignTable = foreignTable;
this._ForeignKey = foreignKey;
this._MainKey = mainKey;
this._DataType = dataType;
this._ShowField = showField;
}
///
/// 数据类型
///
public DbType[] DataType
{
get
{
return this._DataType;
}
}
///
/// 外键
///
public string[] ForeignKey
{
get
{
return this._ForeignKey;
}
}
///
/// 外键所在的表
///
public string ForeignTable
{
get
{
return this._ForeignTable;
}
}
///
/// 关键字
///
public string Key
{
get
{
return this._Key;
}
}
///
/// 主键
///
public string[] MainKey
{
get
{
return this._MainKey;
}
}
///
/// 显示值的字段
///
public string ShowField
{
get
{
return this._ShowField;
}
}
}
}