Ejemplo n.º 1
0
        public static void DoWithTransaction()
        {
            using (ITransientTransaction tran = context.BeginTransaction())
            {
                /* do some things here */
                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);

                tran.Commit();
            }

            ConsoleHelper.WriteLineAndReadKey();
        }