我正在使用ASP.Net Core 1.1。我的模型是这样的 -
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 )
任何人都可以帮助我,我做错了吗?
提前感谢您的帮助。
答案 0 :(得分:0)