123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Text;
- namespace Ant.ORM
- {
- /// <summary>
- /// 字段标签
- /// </summary>
- [AttributeUsage(AttributeTargets.Property)]
- public class DataFieldColumnAttribute : Attribute
- {
- private string name;
- /// <summary>
- /// 列名
- /// </summary>
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- private DbType dbType;
- /// <summary>
- /// 类型
- /// </summary>
- public DbType DbType
- {
- get { return dbType; }
- set { dbType = value; }
- }
- private object defaultValue;
- /// <summary>
- /// 默认值
- /// </summary>
- public object DefaultValue
- {
- get { return defaultValue; }
- set { defaultValue = value; }
- }
- private bool isPrimaryKey = false;
- /// <summary>
- /// 是否为主键
- /// </summary>
- public bool IsPrimaryKey
- {
- get { return isPrimaryKey; }
- set { isPrimaryKey = value; }
- }
- private bool isForeignKey = false;
- /// <summary>
- /// 是否为外键
- /// </summary>
- public bool IsForeignKey
- {
- get { return isForeignKey; }
- set { isForeignKey = value; }
- }
- private bool isNullable = true;
- /// <summary>
- /// 是否为空
- /// </summary>
- public bool IsNullable
- {
- get { return isNullable; }
- set { isNullable = value; }
- }
- private bool isAutoincrement = false;
- /// <summary>
- /// 是否为自动增长
- /// </summary>
- public bool IsAutoincrement
- {
- get { return isAutoincrement; }
- set { isAutoincrement = value; }
- }
- public DataFieldColumnAttribute(string name, DbType dbType)
- {
- this.name = name;
- this.DbType = dbType;
- }
- }
- }
|