Ejemplo n.º 1
0
        static void deleteTest()
        {
            ds.BeginTransaction();
            var q = ds.OrderDetailRepository.Query(Projection.BaseTable)
                    .Where(nameof(OrderDetail.ProductId), OperatorLite.Equals, 9);


            var count = q.GetCount();

            var deletedCount = q.Delete();

            var countAfterDelete = q.GetCount();

            ds.Rollback();
        }
Ejemplo n.º 2
0
        //static void ShowAllEmployeesThatSoldSpecifiedProducts()
        //{

        //    var query = ds.EmployeeRepository.ThatSoldAllSpecifiedProductsQuery(Enumerable.Range(1, 6))
        //        .Fields(EmployeeFields.EmployeeId, EmployeeFields.FirstName, EmployeeFields.LastName)
        //        .OrderBy(EmployeeFields.FirstName, EmployeeFields.LastName);



        //    var any = query.Any();

        //    foreach (var e in query.ToEnumerable())
        //    {
        //        Console.WriteLine("{0}: {1} {2}", e.EmployeeId, e.FirstName, e.LastName);
        //    }
        //}

        static void InsertMultipleItems(int itemCount)
        {
            ds.BeginTransaction();
            for (int i = 1; i < itemCount; i++)
            {
                var item = new Entities.Item
                {
                    Field1 = "Field 1." + i.ToString(),
                    Field2 = "Field 2." + i.ToString(),
                    Field3 = "Field 3." + i.ToString(),
                    Field4 = "Field 4." + i.ToString()
                };
                ds.ItemRepository.Insert(item);
            }
            ds.Commit();
        }