我正在使用ASP.Net Core 1.1。我的模型就像是這個 -ASP.NetCore - RuntimeBinderException:以下方法或屬性之間的調用不明確
public class JobCircular
{
[Key]
public UInt64 Id { get; set; }
public string Name { get; set; }
public string Detail { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss.S}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime StartDate { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss.S}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime EndDate { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss.S}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime AddedDate { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd HH:mm:ss.S}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime LastModifiedDate { get; set; }
public DbSet<Teacher> Teachers { get; set; }
public JobCircular()
{
AddedDate = DateTime.UtcNow;
LastModifiedDate = DateTime.UtcNow;
}
}
我的數據庫爲DbModel之後,就像是這個 -
,我在控權
using (var context = new ApplicationDbContext())
{
Random rnd = new Random();
UInt16 year = (UInt16)rnd.Next(1999, 2017);
var jobCircular1 = context.JobCirculars;
JobCircular jobCircular = context.JobCirculars
.SingleOrDefault(j => j.Id == 1);
...........................
...........................
}
這樣做的,我得到此錯誤 -
An unhandled exception occurred while processing the request.
RuntimeBinderException: The call is ambiguous between the following methods or properties: 'Microsoft.EntityFrameworkCore.Storage.RelationalSqlGenerationHelper.GenerateLiteralValue(float)' and 'Microsoft.EntityFrameworkCore.Storage.RelationalSqlGenerationHelper.GenerateLiteralValue(decimal)'
CallSite.Target(Closure , CallSite , RelationalSqlGenerationHelper , object)
任何人都可以請幫助我,我做錯了什麼?
在此先感謝您的幫助。
看看這個類似的問題:https://github.com/aspnet/EntityFrameworkCore/issues/8259。似乎這是EF核心庫問題。 –
在這種情況下,我該怎麼辦? @TetsuyaYamamoto –