public object Any(MiniProfiler request) { var profiler = Profiler.Current; using (var db = DbFactory.OpenDbConnection()) using (profiler.Step("MiniProfiler Service")) { if (request.Type == "n1") { using (profiler.Step("N + 1 query")) { var results = new List<Movie>(); foreach (var movie in db.Select<Movie>()) { results.Add(db.QueryById<Movie>(movie.Id)); } return results; } } using (profiler.Step("Simple Select all")) { return db.Select<Movie>(); } } }
public object Any(MiniProfiler request) { var profiler = Profiler.Current; using (var db = DbFactory.OpenDbConnection()) using (profiler.Step("MiniProfiler Service")) { if (request.Type == "n1") { using (profiler.Step("N + 1 query")) { return db.Select<Movie>().Select(movie => db.SingleById<Movie>(movie.Id)).ToList(); } } using (profiler.Step("Simple Select all")) { return db.Select<Movie>(); } } }