123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Data;
- namespace Ant.ORM
- {
- /// <summary>
- /// 引用对象的关系(扩展对象)
- /// </summary>
- [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;
- /// <summary>
- /// 扩展对象及关联对象
- /// </summary>
- /// <param name="key">关键字</param>
- /// <param name="maintable">主表</param>
- /// <param name="foreignTable">外键所在的表</param>
- /// <param name="mainKey">主表主键</param>
- /// <param name="foreignKey">外键关联的字段</param>
- /// <param name="dataType">数据类型</param>
- /// <param name="showField">显示字段</param>
- 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;
- }
- /// <summary>
- /// 数据类型
- /// </summary>
- public DbType[] DataType
- {
- get
- {
- return this._DataType;
- }
- }
-
- /// <summary>
- /// 外键
- /// </summary>
- public string[] ForeignKey
- {
- get
- {
- return this._ForeignKey;
- }
- }
- /// <summary>
- /// 外键所在的表
- /// </summary>
- public string ForeignTable
- {
- get
- {
- return this._ForeignTable;
- }
- }
- /// <summary>
- /// 关键字
- /// </summary>
- public string Key
- {
- get
- {
- return this._Key;
- }
- }
- /// <summary>
- /// 主键
- /// </summary>
- public string[] MainKey
- {
- get
- {
- return this._MainKey;
- }
- }
- /// <summary>
- /// 显示值的字段
- /// </summary>
- public string ShowField
- {
- get
- {
- return this._ShowField;
- }
- }
- }
- }
|