IQueryable<T> x;
IQueryable<T> y;
var rslt = x.Union(y);
2. Union all
IQueryable<T> x;
IQueryable<T> y;
var rslt = x.Concat(y);
// 1: Save after iteration (recommended approach in most cases)
using (var context = new MyContext())
{
foreach (var person in context.People)
{
// Change to person
}
context.SaveChanges();
}
// 2: Declare an explicit transaction
using (var transaction = new TransactionScope())
{
using (var context = new MyContext())
{
foreach (var person in context.People)
{
// Change to person
context.SaveChanges();
}
}
transaction.Complete();
}