2
How to make an expression using EPH so that when a certain list of objects is sent and already exists in the database, it is updated and the change is inserted in another historical entity, otherwise, it inserts the two entities.
Example
public void Insere(List<T> objeto)
{
using (Context ctx = new Context())
{
if(objeto.Select(x => x.Id).Intersect(ctx.Entidade.Select(x => x.Id)).Any() > 0){
//Atualizo apenas os registros existentes e insiro no histórico (Para cada item da lista)
}
//Insiro os registros inexistentes e insiro no histórico (Para cada item da lista)
}
What version of the RU has this extension?
– Marco Souza
@As far as I know, since EF 5.
– Leonel Sanches da Silva