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.
61 lines
1.9 KiB
61 lines
1.9 KiB
1 year ago
|
using System;
|
||
|
using System.ComponentModel.DataAnnotations;
|
||
|
|
||
|
namespace ChangkeTec.SDMS.Model.Attributes
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 列来源属于
|
||
|
/// </summary>
|
||
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||
|
public class ColumnSource : Attribute
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// </summary>
|
||
|
/// <param name="sourceType">列来源。ENUM:枚举数据源.TABLE表数据源(外键关系)</param>
|
||
|
/// <param name="typeName">来源数据源类型</param>
|
||
|
/// <param name="columnNames">
|
||
|
/// sourceType为TABLE时,columName是对应表中的列名
|
||
|
/// columnNames[0]: ValueMember ,colums[1]:DisplayMember
|
||
|
public ColumnSource(ColumnSourceType sourceType, Type typeName, string[] columnNames = null,
|
||
|
string selector = null)
|
||
|
{
|
||
|
SourceType = sourceType;
|
||
|
TypeName = typeName;
|
||
|
ColumnNames = columnNames;
|
||
|
Selector = selector;
|
||
|
}
|
||
|
|
||
|
|
||
|
public ColumnSourceType SourceType { get; }
|
||
|
|
||
|
/// <summary>获取或设置属性映射到的列的从零开始的顺序。</summary>
|
||
|
/// <returns>列的顺序。</returns>
|
||
|
public Type TypeName { get; }
|
||
|
|
||
|
/// <summary>获取或设置该属性映射到的列的数据库提供程序特定的数据类型。</summary>
|
||
|
/// <returns>属性将映射到的列的数据库提供程序特定数据类型。</returns>
|
||
|
[StringLength(50)]
|
||
|
public string[] ColumnNames { get; }
|
||
|
|
||
|
[StringLength(50)]
|
||
|
public string Selector { get; set; }
|
||
|
}
|
||
|
|
||
|
public enum ColumnSourceType
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 枚举数据源
|
||
|
/// </summary>
|
||
|
ENUM = 1,
|
||
|
|
||
|
/// <summary>
|
||
|
/// 表数据源
|
||
|
/// </summary>
|
||
|
TABLE = 2,
|
||
|
|
||
|
/// <summary>
|
||
|
/// bool类型
|
||
|
/// </summary>
|
||
|
Boolean = 4
|
||
|
}
|
||
|
}
|