IntentArchitect / Support

A repository dedicated to handling issues and support queries
3 stars 0 forks source link

Intent.EntityFrameworkCore.Repositories.EFRepositoryInterface - Expose the "sync" version of `Any` #73

Closed shainegordon closed 1 year ago

shainegordon commented 1 year ago

What problem are you trying to solve?

Somes it is easier to use the synchronous methods of EF Core e.g. inside a Fluent Validation .Must function.

RepositoryBase already has the .Any method, it just needs to be added to the interface, so that it is accessible on the domain-specific repositories

Describe the solution you'd like

add the following line to IEFRepository - bool Any(Expression<Func<TPersistence, bool>> filterExpression);

shainegordon commented 1 year ago

Added PR https://github.com/IntentArchitect/Intent.Modules.NET/pull/8

JonathanLydall commented 1 year ago

Hi @shainegordon,

Many thanks for the PR, we can certainly add synchronous equivalents for all the current asynchronous operations, but just behind a an application setting.

Our of interest, why not use FluentValidation's MustAsync in this case?

joelsteventurner commented 1 year ago

Hi @shainegordon I have published a pre-release module which addresses this issue. If you install Intent.EntityFrameworkCore.Repositories v4.2.10-pre.0

I have added a Database setting (see below) which when turned on adds synchronous versions of the repository methods to the repository.

image