コード例 #1
0
        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>();
				}
			}
		}
コード例 #2
0
ファイル: ProfilerService.cs プロジェクト: GDBSD/ServiceStack
        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>();
                }
            }
        }