mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 ColumnAttribute 可插入(CanInsert)、可更新(CanUpdate);#99
This commit is contained in:
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user