public static void DoWithTransactionEx() { context.DoWithTransaction(() => { context.Update <User>(a => a.Id == 1, a => new User() { Name = a.Name, Age = a.Age + 1, Gender = Gender.Man, OpTime = DateTime.Now }); context.Delete <User>(a => a.Id == 1024); }); ConsoleHelper.WriteLineAndReadKey(); }