Esempio n. 1
0
 private static int SelectPartTest(string connectionString)
 {
     var table = new Home("ORMTest");
     return table.All(where: "where BuildYear<@0", args: 2000).Count();
 }
Esempio n. 2
0
 private static int Update100Test(string connectionString)
 {
     var table = new Home("ORMTest");
     var toUpdate = table.All("WHERE BuildYear=@0", args: 2014).ToArray();
     int counter = 0;
     foreach (var home in toUpdate)
     {
         home.BuildYear = 2015;
         counter++;
     }
     table.Save(toUpdate);
     return counter;
 }
Esempio n. 3
0
 private static int SelectJoinTest(string connectionString)
 {
     var table = new Home("ORMTest");
     return table.Query(@"SELECT h.*
     from Home h
     inner join Province p on h.ProvinceId=p.Id
     where p.Code=@0", 10).Count();
 }
Esempio n. 4
0
 private static int SelectAllTest(string connectionString)
 {
     var table = new Home("ORMTest");
     return table.All().Count();
 }
Esempio n. 5
0
        private static int InsertTest(string connectionString)
        {
            var table = new Home("ORMTest");
            var provinces = new Province("ORMTest").All();

            foreach (var home in ORMPerformanceTest.TestData.HomeData.Get100Homes())
            {
                table.Insert(new
                {
                    BuildYear = home.BuildYear,
                    City = home.City,
                    Description = home.Description,
                    ProvinceId = provinces.First(i => i.Code == home.HomeProvince.Code).Id,
                    Price = home.Price,
                    Surface = home.Surface,
                    AddTime = DateTime.Now
                });
            }
            return 100;
        }
Esempio n. 6
0
 private static int Delete100Test(string connectionString)
 {
     var table = new Home("ORMTest");
     return table.Delete(where: "WHERE BuildYear=@0", args: 2015);
 }
Esempio n. 7
0
 private static int CountTest(string connectionString)
 {
     var table = new Home("ORMTest");
     long count = table.Count();
     return 1;
 }