src/02_Data/Data.Abstractions/Annotations/ColumnAttribute.cs

(完整代码) 1KB

using System;

namespace Mkh.Data.Abstractions.Annotations;

/// <summary>
/// 列名,指定实体属性在表中对应的列名
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
    /// <summary>
    /// 列名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 列类型名称
    /// </summary>
    public string Type { get; set; }

    /// <summary>
    /// 默认值
    /// </summary>
    public string DefaultValue { get; set; }

    /// <summary>
    /// 列说明
    /// </summary>
    public string Description { get; set; }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="description">列说明</param>
    /// <param name="type">列类型</param>
    /// <param name="defaultValue">默认值</param>
    /// <param name="name">列名</param>
    public ColumnAttribute(string description, string defaultValue = null, string type = null, string name = null)
    {
        Description = description;
        DefaultValue = defaultValue;
        Type = type;
        Name = name;
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。