Exemplo n.º 1
0
 public async Task SaveAsyncWithRetryTest()
 {
     using (var context = new DevTestContext())
     {
         var order = new Order
         {
             OrderNo     = SequenceNoUtils.GenerateNo('O'),
             OrderAmount = 10000,
             ProductNo   = "PN1001",
             UserNo      = "UID1001"
         };
         await context.SaveAsync(order);
     }
 }
Exemplo n.º 2
0
 public void SaveOrUpdateWithRetryTest()
 {
     using (var context = new DevTestContext())
     {
         var order = new Order
         {
             OrderNo     = SequenceNoUtils.GenerateNo('O'),
             OrderAmount = 10000,
             ProductNo   = "PN1001",
             UserNo      = "UID1001"
         };
         context.Save(order);
         context.SaveOrUpdate(order, x => x.Id == order.Id);
     }
 }
Exemplo n.º 3
0
        public void Action(DbContextBase context)
        {
            var orders = new List <Order>
            {
                new Order
                {
                    OrderNo     = SequenceNoUtils.GenerateNo('O'),
                    OrderAmount = 10000,
                    ProductNo   = "PN1001",
                    UserNo      = "UID1001"
                },
                new Order
                {
                    OrderNo     = SequenceNoUtils.GenerateNo('O'),
                    OrderAmount = 10000,
                    ProductNo   = "PN1001",
                    UserNo      = "UID1001"
                },
                new Order
                {
                    OrderNo     = SequenceNoUtils.GenerateNo('O'),
                    OrderAmount = 10000,
                    ProductNo   = "PN1001",
                    UserNo      = "UID1001"
                },
                new Order
                {
                    OrderNo     = SequenceNoUtils.GenerateNo('O'),
                    OrderAmount = 10000,
                    ProductNo   = "PN1001",
                    UserNo      = "UID1001"
                }
            };

            orders.ForEach(context.Add);
        }