I'm using LINQ to connect to a third party database.
Now I have to insert some records into a table that have no primary key set and I get this exception:
System.InvalidOperationException: Can't perform Create, Update or Delete operations on 'Table (the_table)' because it has no primary key.
How can I solve this? should I use ExecuteCommand
to avoid this exception?
ExecuteCommand
将为您提供更好的性能,因为您可以删除一个查询中的所有记录。
在EF模型中使用唯一列作为PK。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.