我正在尝试在我的迁移配置文件中播种一些数据。我创建了位置类的新实例
var location = new Location
{
Name = "Test",
Street = "Test",
City = "Test",
State = "Test",
ZipCode = "Test",
Country = "US",
PhoneNumber = "Test",
EmailAddress = null,
Website ="Test",
Latitude = Convert.ToDecimal(35.137592),
Longitude = Convert.ToDecimal(-85.124883)
};
为了播种,我有
context.Locations.AddOrUpdate(
t =>
new
{
t.Name,
t.Street,
t.City,
t.State,
t.ZipCode,
t.Country,
t.PhoneNumber,
t.EmailAddress,
t.Website,
t.Latitude,
t.Longitude
}, location);
纬度和经度都是十进制的?类型。
尝试运行此迁移时出现以下错误:
没有为类型“System.Nullable`1[System.Decimal]”和“System.Decimal”定义二元运算符 Equal。
我该如何解决?