- 增加 创建表时指定字段位置,如:[Column(Position = 1],可为负数即反方向位置;

This commit is contained in:
28810
2019-09-04 22:52:05 +08:00
parent 4d2406aa1e
commit 6e75a8cebc
13 changed files with 103 additions and 36 deletions

View File

@ -79,5 +79,17 @@ namespace FreeSql.DataAnnotations
/// 类型映射,比如:可将 enum 属性映射成 typeof(string)
/// </summary>
public Type MapType { get; set; }
}
internal short? _Position;
/// <summary>
/// 创建表时字段位置,规则如下:
/// <para></para>
/// &gt;0时排前面1,2,3...
/// <para></para>
/// =0时排中间(默认)
/// <para></para>
/// &lt;0时排后面...-3,-2,-1
/// </summary>
public short Position { get => _Position ?? 0; set => _Position = value; }
}
}

View File

@ -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>
/// &gt;0时排前面
/// <para></para>
/// =0时排中间(默认)
/// <para></para>
/// &lt;0时排后面
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public ColumnFluent Position(short value)
{
_column.Position = value;
return this;
}
}