我正在尝试在我的迁移配置文件中植入一些数据。我已经创建了location类的一个新实例
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`1System.Decimal“”和“”System.Decimal“”定义二元运算符“”。“”
我该如何解决这个问题?
发布于 2012-06-01 01:13:52
已更改为
context.Locations.AddOrUpdate(t => t.Name,location);这样它就只检查Name列(本例中为string)
https://stackoverflow.com/questions/10837265
复制相似问题