You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
In order to make one call to the db and filter the updated set with custom filter it would be great to make filters work with UPDATE/DELETE EF generated queries.
When I make something like:
UPDATE [dbo].[EntityTable]
SET ....
WHERE ([Id] = @1)
It would be great if filters could inject parameters to UPDATE/DELETE like it is for SELECT queries, so when I add FilterConvention.Create and enable the filter, it's injected in UPDATE/DELETE where clause.
The text was updated successfully, but these errors were encountered:
By default EF uses PK fields in WHERE clause in UPDATE/DELETE. For instance, I have Address table with AddressId as PK, UserId as FK to User's table record and some other fields. To update or delete address from API, let's say, caller must provide AddressId. So to force security rule "user can UPDATE/DELETE what belongs to him (records with his UserId)" I have 2 options here:
Make a call to retrieve the Address by UserId and AddressId. If retrieved object is not null, then we can update/delete it, so 2 calls are needed, which is not elegant solution.
Use API of https://github.com/loresoft/EntityFramework.Extended , but it makes call to the db when calling .Update(expression) or .Delete(expression), I don't know why it was implemented this way, maybe because of EF design limits, but I don't like this idea of making Update/Delete calls before making .SaveChanges().
That's why I thought it would be a great feature to add to the EF.Filters functionality in order to make filtering of what can be updated/deleted when making UPDATE/DELETE with EF.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In order to make one call to the db and filter the updated set with custom filter it would be great to make filters work with UPDATE/DELETE EF generated queries.
When I make something like:
By default EF creates:
It would be great if filters could inject parameters to UPDATE/DELETE like it is for SELECT queries, so when I add
FilterConvention.Create
and enable the filter, it's injected in UPDATE/DELETE where clause.The text was updated successfully, but these errors were encountered: