簡體   English   中英

DBContext.Entry(Entity).Property(fieldname) 在升級到 dotnet core 2.2 后停止工作

[英]DBContext.Entry(Entity).Property(fieldname) stopped working after upgrading to dotnet core 2.2

我有一個通用方法,我調用該方法將分離的實體添加到 DBContext

更新后,GetProperties 不會返回不可為空的 TimeSpan 屬性。

public void AddEntity<T>(DbSet<T> entityList, T entity) where T : BaseEntity
{
    DBContext.Entry(entity).Metadata.GetProperties()
}

這不是 dotnet core 2.2 的問題

較新版本的 dotnet core 更加嚴格。

在生成的類中我有

public TimeSpan StartTime { get; set; }
public TimeSpan EndTime { get; set; }

在生成的部分類中,我有

[NotMapped]
TimeSpan? ISchedule.StartTime

[NotMapped]
TimeSpan? ISchedule.EndTime

在新版本中,[NotMapped] 屬性取消了兩個 StartTime 屬性

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM