- 增加 ColumnAttribute 可插入(CanInsert)、可更新(CanUpdate);#99

This commit is contained in:
28810
2019-09-26 15:45:40 +08:00
parent d4c766e0b6
commit 6ca226a8e4
7 changed files with 137 additions and 1 deletions

View File

@ -94,5 +94,15 @@ namespace FreeSql.DataAnnotations
/// <0时排后面...-3,-2,-1
/// </summary>
public short Position { get => _Position ?? 0; set => _Position = value; }
internal bool? _CanInsert, _CanUpdate;
/// <summary>
/// 该字段是否可以插入默认值true指定为false插入时该字段会被忽略
/// </summary>
public bool CanInsert { get => _CanInsert ?? true; set => _CanInsert = value; }
/// <summary>
/// 该字段是否可以更新默认值true指定为false更新时该字段会被忽略
/// </summary>
public bool CanUpdate { get => _CanUpdate ?? true; set => _CanUpdate = value; }
}
}

View File

@ -113,5 +113,26 @@ namespace FreeSql.DataAnnotations
_column.Position = value;
return this;
}
/// <summary>
/// 该字段是否可以插入默认值true指定为false插入时该字段会被忽略
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public ColumnFluent CanInsert(bool value)
{
_column.CanInsert = value;
return this;
}
/// <summary>
/// 该字段是否可以更新默认值true指定为false更新时该字段会被忽略
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public ColumnFluent CanUpdate(bool value)
{
_column.CanUpdate = value;
return this;
}
}
}