public long GetCustomersByCountry(string countryName) { Stopwatch clock = new Stopwatch(); clock.Start(); var query = from c in db.Customers where c.Country == countryName select c; clock.Stop(); query.ToList(); var elapsedTime = clock.ElapsedMilliseconds; ResultComparer.getCustomerData(query.ToList(), method); return(elapsedTime); }
public long GetCustomersByCountry(string countryName) { Stopwatch clock = new Stopwatch(); clock.Start(); List <Customer> result; using (IDbConnection db = new SqlConnection(connString)) { result = db.Query <Customer>(Constants.GET_CUSTOMERS_BY_COUNTRY, new { Country = countryName }).ToList(); } clock.Stop(); ResultComparer.getCustomerData(result, method); var elapsedTime = clock.ElapsedMilliseconds; return(elapsedTime); }
public long GetCustomersByCountry(string countryName) { Stopwatch clock = new Stopwatch(); clock.Start(); List <Customer> result; using (NwEntityContext context = new NwEntityContext()) { result = context.Customers.Where(x => x.Country == countryName).ToList(); } clock.Stop(); var elapsedTime = clock.ElapsedMilliseconds; ResultComparer.getCustomerData(result, method); return(elapsedTime); }