JonPSmith / EfCore.GenericServices

A library to help you quickly code CRUD accesses for a web/mobile/desktop application using EF Core.
https://www.thereformedprogrammer.net/genericservices-a-library-to-provide-crud-front-end-services-from-a-ef-core-database/
MIT License
601 stars 94 forks source link

Read many tracked? #28

Closed Tealons closed 5 years ago

Tealons commented 5 years ago

We are using the GenericServices library for our project and it is very useful in almost every scenario! Except when update a list of objects. For example: a list of object with a bool property we want to toggle. In that case, a read many function that can read tracked database models would be handy. Is there any reason why you implemented this for the read single, but not the read many function?

Is it just time / effort? Or is there any technical reason why this would not work?

JonPSmith commented 5 years ago

Hi @Tealons,

I have tried to keep the GenericServices library very focused on straightforward CRUD - that way the library easy to understand and use. For complex CRUD I write a small service using EF Core directly.

So, in your situation I would write a small class to implement what you need, must likely using GenericServices' IGenericStatus status and dependency injection to make it work in the same as GenericServices actions.

PS. You may find this article GenericServices Design Philosophy + tips and techniques for more on what GenericServices is focused on.

tej-rana commented 5 years ago

This could be a very good update based on performance. They will fix this issue in version 3.https://github.com/aspnet/EntityFrameworkCore/issues/14366

JonPSmith commented 5 years ago

Hi @tesnep,

Yes, that looks very interesting! I compared GenericServices against hand-coded versions, both both used AsNoTracking. It does look like there are cleaning up a whole load of small issues in EF Core 3.0. Can't wait!