using Apewer.Internals; using System; using System.Collections.Generic; using System.Text; namespace Apewer.Source { /// 数据库中的表。 [Serializable] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] public sealed class TableAttribute : Attribute { private string _name; private bool _independent = false; private bool _locked = false; /// public TableAttribute(string name = null) { _name = TableStructure.RestrictName(name, string.IsNullOrEmpty(name)); } /// internal TableAttribute(string name, bool underline) { _name = TableStructure.RestrictName(name, underline); } /// 表名。 public string Name { get { return _name; } set { if (_locked) return; _name = TableStructure.RestrictName(value, false); } } /// public bool Independent { get { return _independent; } internal set { if (_locked) return; _independent = value; } } /// public override int GetHashCode() { return _name.GetHashCode(); } /// 锁定属性,阻止修改。 public void Lock() { _locked = true; } } }