Skip to content

Conversation

@Simon-Carr
Copy link

DeleteAllAsync() and GetAllAsync() overloads accept a predicate expression that can be used to limit the scope of the action. I.E filter records returned or deleted.

This is obviously limited compared to what you can achieve with the QueryAsync or ExecuteAsync methods but does allow you to stay in the Dapper.Contrib world for simple use cases and not require any SQL strings.

For example to return entities where Age = 5:

await connection.GetAllAsync<User>(x => x.Age == 5)

For example to delete entities where Age = 5:

await connection.DeleteAllAsync<User>(x => x.Age == 5)

Some supporting tests have been added.

DeleteAllAsync() and GetAllAsync() overloads accept a predicate expression that can be used to limit the scope of the action. I.E filter records returned or deleted.
@Simon-Carr
Copy link
Author

I'm not sure why the build failures occur for this PR, can anyone advise?

I submitted this because the functionality would be super-useful for my own projects and therefore, I assume, others would find it useful too.
Can anyone give any feedback?

@NickCraver
Copy link
Member

I can't speak to Contrib's future plans here and if this is a good fit, but please see #1658 - Dapper.Contrib is not located at https://github.com/DapperLib/Dapper.Contrib (separate from this repository). If you're wanting predicated functionality on builders, I'd personally recommend EntityFramework Core overall as it has progressed and gotten quite efficient.

@NickCraver NickCraver closed this May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants