- 增加 实体特性 [Column(ServerTime = DateTimeKind.Utc)] 使用数据库时间执行插入数据;

- 修复 ToList(a => new Dto { .. }) 在使用 GroupBy 之后报错的 bug;
- 修复 注释迁移到数据库,在 asp.net 4.7 无效的问题;
This commit is contained in:
28810
2019-11-25 17:30:36 +08:00
parent 27acd4da08
commit 01b31c095b
49 changed files with 332 additions and 146 deletions

View File

@ -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;
}
}
}
}

View File

@ -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;
}
}
}