// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Linq; namespace Tx.NonXADB.EF { public class Good : DB { public override MyDbContext GetDbContext() { return new MyDbContext("MYSQL"); } public override void Test() { for(int i = 0; i < 10; i++) { using(MyDbContext ctx = GetDbContext()) { TblSrc osrc = ctx.TblSrc.First(row => row.Id == 1); osrc.Val = osrc.Val - 1; ctx.SaveChanges(); TblTrg otrg = ctx.TblTrg.First(row => row.Id == 1); otrg.Val = otrg.Val + 1; ctx.SaveChanges(); } } } public static void Main(string[] args) { Demo(new Good()); Console.ReadKey(); } } }