You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
using Apewer.Internals;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Apewer.Source
|
|
{
|
|
|
|
/// <summary>数据库中的表。</summary>
|
|
[Serializable]
|
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
|
|
public sealed class TableAttribute : Attribute
|
|
{
|
|
|
|
private string _name;
|
|
private bool _allprops = false;
|
|
private bool _independent = false;
|
|
|
|
/// <summary></summary>
|
|
public TableAttribute(string name = null, bool allProperties = false)
|
|
{
|
|
_name = TableStructure.RestrictName(name, string.IsNullOrEmpty(name));
|
|
_allprops = allProperties;
|
|
}
|
|
|
|
/// <summary>表名。</summary>
|
|
public string Name
|
|
{
|
|
get => _name;
|
|
set => _name = TableStructure.RestrictName(value, false);
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public bool Independent
|
|
{
|
|
get => _independent;
|
|
internal set => _independent = value;
|
|
}
|
|
|
|
/// <summary>使用所有属性,即使属性不带有 Column 特性。</summary>
|
|
public bool AllProperties
|
|
{
|
|
get => _allprops;
|
|
set => _allprops = value;
|
|
}
|
|
|
|
/// <summary></summary>
|
|
public override int GetHashCode() => _name.GetHashCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|