private static void ProfilingUpdateMany(ISisoDatabase database, int customerNoFrom, int customerNoTo) { var stopWatch = new Stopwatch(); stopWatch.Start(); using (var session = database.BeginWriteSession()) { session.UpdateMany<Customer>( c => c.CustomerNo >= customerNoFrom && c.CustomerNo <= customerNoTo, customer => { customer.Firstname += "Udated"; }); } stopWatch.Stop(); Console.WriteLine("TotalSeconds = {0}", stopWatch.Elapsed.TotalSeconds); using (var rs = database.BeginReadSession()) { var rowCount = rs.Query<Customer>().Count(); Console.WriteLine("Total rows = {0}", rowCount); } }
private static void ProfilingInserts(ISisoDatabase database, int numOfCustomers, int numOfItterations) { var stopWatch = new Stopwatch(); for (var c = 0; c < numOfItterations; c++) { var customers = CustomerFactory.CreateCustomers(numOfCustomers); stopWatch.Start(); InsertCustomers(customers, database); stopWatch.Stop(); Console.WriteLine("TotalSeconds = {0}", stopWatch.Elapsed.TotalSeconds); stopWatch.Reset(); } using (var rs = database.BeginReadSession()) { var rowCount = rs.Query<Customer>().Count(); Console.WriteLine("Total rows = {0}", rowCount); } }
private static int GetCustomersAsJsonViaIndexesTable(ISisoDatabase database, int customerNoFrom, int customerNoTo) { using (var session = database.BeginReadSession()) { return session.Query<Customer>().Where(c => c.CustomerNo >= customerNoFrom && c.CustomerNo <= customerNoTo && c.DeliveryAddress.Street == "The delivery street #544").ToEnumerableOfJson().Count(); } }
private static int GetAllCustomers(ISisoDatabase database) { using(var session = database.BeginReadSession()) { return session.Query<Customer>().ToEnumerable().Count(); } }