RollerCosta
RollerCosta

Reputation: 5196

Linq to Entity delete a row from a table have no primary key

Q1.Can LINQ to Entity perform create, update or delete operations on a table without a primary key.??
if not then suggest me an alternate

Q2.I am not able to use DeleteObject to delete a row from a table (error::missing an assembly). What should i do to use DeleteObject.

As an alternate to q2.(delete object) i tried
db.check_master.Remove(checks); (error:: Unable to update the EntitySet 'entitysetName' because it has a DefiningQuery and no element exists in the element to support the current operation)

Not able to access any object provided by EF like Attach,DeleteObject...etc. (Using code first with existing database approach)

Upvotes: 0

Views: 1281

Answers (1)

Abhishek
Abhishek

Reputation: 1702

It would be really convenient to you if you add primary key.

Perhaps otherwise, you'll need to use DataContext.ExecuteCommand().

Upvotes: 2

Related Questions