mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 创建表时指定字段位置,如:[Column(Position = 1],可为负数即反方向位置;
This commit is contained in:
@ -79,5 +79,17 @@ namespace FreeSql.DataAnnotations
|
||||
/// 类型映射,比如:可将 enum 属性映射成 typeof(string)
|
||||
/// </summary>
|
||||
public Type MapType { get; set; }
|
||||
}
|
||||
|
||||
internal short? _Position;
|
||||
/// <summary>
|
||||
/// 创建表时字段位置,规则如下:
|
||||
/// <para></para>
|
||||
/// >0时排前面,1,2,3...
|
||||
/// <para></para>
|
||||
/// =0时排中间(默认)
|
||||
/// <para></para>
|
||||
/// <0时排后面,...-3,-2,-1
|
||||
/// </summary>
|
||||
public short Position { get => _Position ?? 0; set => _Position = value; }
|
||||
}
|
||||
}
|
||||
|
@ -89,11 +89,28 @@ namespace FreeSql.DataAnnotations
|
||||
/// <summary>
|
||||
/// 类型映射,比如:可将 enum 属性映射成 typeof(string)
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public ColumnFluent MapType(Type type)
|
||||
public ColumnFluent MapType(Type value)
|
||||
{
|
||||
_column.MapType = type;
|
||||
_column.MapType = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表时字段位置,规则如下:
|
||||
/// <para></para>
|
||||
/// >0时排前面
|
||||
/// <para></para>
|
||||
/// =0时排中间(默认)
|
||||
/// <para></para>
|
||||
/// <0时排后面
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public ColumnFluent Position(short value)
|
||||
{
|
||||
_column.Position = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user