MikaelEliasson / EntityFramework.Utilities

Provides extensions for EntityFramework that doesn't exist out of the box like delete and update by query and bulk inserts
443 stars 175 forks source link

Is it possible to have a generic implementation of UpdateAll? #86

Open mateusmcg opened 8 years ago

mateusmcg commented 8 years ago

Is there a way that i can use the UpdateAll generically? For example:

Let's suppose i have a BaseRepository that receives a list of entities of type T and i want to update all properties of the entire list (In other words a generic BulkUpdate).

I'm trying to do something like this:

EFBatchOperation.For(Context, this.entities.Set<T>()).UpdateAll(<List T goes here>, e => e.ColumnsToUpdate(p => p.<Get All Props Here>));

But, obviously, no success so far.

Sorry if this is a dumb question, but i could find nothing related so far and i really need a light here.

RubberChickenParadise commented 8 years ago

UpdateAll is all ready a generic acting on TContext, T with a limit on T being a class.

Do you have a larger code sample of what you are trying to do?

AleksandarGajic commented 7 years ago

@mateusmcg did you figure out how to create a generic UpdatedAll?

RudeySH commented 6 years ago

Are you looking for an UpdateAll implementation that updates all columns? If so, see #106 for further discussion.