arch / UnitOfWork

A plugin for Microsoft.EntityFrameworkCore to support repository, unit of work patterns, multiple database with distributed transaction supported, and MySQL multiple databases/tables sharding supported.
MIT License
1.34k stars 343 forks source link

Add Selector to parameterized GetAll #147

Closed djechelon closed 3 years ago

djechelon commented 3 years ago

Related to #146

The change is very simple and is made only for purpose of symmetricity.

There is already a (not recommended) method GetAll which must be used with caution when dealing with large data sets. This change only adds the possibility to use a Selector within the existing method invocation.

Adding the selector explicitly is more useful for the async version, because you can't await for a transformed List, but if you invoke the method synchronously you either chain .Select or just await for .ToListAsync().

The need for GetAll parameterized comes from a business case where the filter is dynamically generated from user input and may be null. IRepository is very efficient at handling optional parameters and reduce calling code size.

rigofunc commented 3 years ago

thanks