mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 增加 实体特性 [Column(ServerTime = DateTimeKind.Utc)] 使用数据库时间执行插入数据;
- 修复 ToList(a => new Dto { .. }) 在使用 GroupBy 之后报错的 bug; - 修复 注释迁移到数据库,在 asp.net 4.7 无效的问题;
This commit is contained in:
@ -43,11 +43,6 @@ namespace FreeSql.DataAnnotations
|
||||
/// </summary>
|
||||
public bool IsVersion { get => _IsVersion ?? false; set => _IsVersion = value; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库默认值
|
||||
/// </summary>
|
||||
public object DbDefautValue { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型映射,除了可做基本的类型映射外,特别介绍的功能:<para></para>
|
||||
/// 1、将 enum 属性映射成 typeof(string)<para></para>
|
||||
@ -76,5 +71,18 @@ namespace FreeSql.DataAnnotations
|
||||
/// 该字段是否可以更新,默认值true,指定为false更新时该字段会被忽略
|
||||
/// </summary>
|
||||
public bool CanUpdate { get => _CanUpdate ?? true; set => _CanUpdate = value; }
|
||||
|
||||
internal DateTimeKind? _ServerTime;
|
||||
/// <summary>
|
||||
/// 标记属性为数据库服务器时间(utc/local),在插入的时候使用类似 getdate() 执行
|
||||
/// </summary>
|
||||
public DateTimeKind ServerTime
|
||||
{
|
||||
get => _ServerTime ?? DateTimeKind.Local;
|
||||
set
|
||||
{
|
||||
_ServerTime = value == DateTimeKind.Unspecified ? DateTimeKind.Local : value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,5 +124,16 @@ namespace FreeSql.DataAnnotations
|
||||
_column.CanUpdate = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标记属性为数据库服务器时间(utc/local),在插入的时候使用类似 getdate() 执行
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public ColumnFluent ServerTime(DateTimeKind value)
|
||||
{
|
||||
_column.ServerTime = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user