private static int SelectPartTest(string connectionString) { var table = new Home("ORMTest"); return table.All(where: "where BuildYear<@0", args: 2000).Count(); }
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; }
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(); }
private static int SelectAllTest(string connectionString) { var table = new Home("ORMTest"); return table.All().Count(); }
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; }
private static int Delete100Test(string connectionString) { var table = new Home("ORMTest"); return table.Delete(where: "WHERE BuildYear=@0", args: 2015); }
private static int CountTest(string connectionString) { var table = new Home("ORMTest"); long count = table.Count(); return 1; }