开发者

Weird linq-to-sql error

开发者 https://www.devze.com 2023-01-28 00:06 出处:网络
the error happens in this line: OldPerson.PersonSerial = context.DB.Persons.Max(Function(p) p.PersonSerial) + 1

the error happens in this line:

OldPerson.PersonSerial = context.DB.Persons.Max(Function(p) p.PersonSerial) + 1

Could not find key member 'ID' of key 'ID' on type 'Nationality'. The key may be wrong or the field or property on 'Nationality' has changed names.

there's a person table containing a foreign key to the nationality table. i checked up that the 开发者_Python百科column names match

what might be the cause of this error?


looks like sharing a base class for partial linq generated classes is causing this issue.

i removed the inheritance from the base class and it worked. No idea why though!

0

精彩评论

暂无评论...
验证码 换一张
取 消