Reputation: 9024
I am trying to delete all records with a certain field.
db.ExecuteStoreQuery(Of Personnel)("Delete From Personnel Where clientId = @clientId", sqlP)
I have seen example where they used;
db.Database.ExecuteSqlCommand("DELETE FROM ...", someParameter);
But I don't have the Database
member on my context. How can I achieve this with an sql string like above?
Upvotes: 0
Views: 489
Reputation: 6023
There are two type of contexts with EF. It looks like you are using type ObjectContext
which does not have the Database
property and thus does not have the ExecuteSqlCommand
method.
With ObjectContext
the related method would be ExecuteStoreCommand()
.
Upvotes: 2