当前位置: 首页>>代码示例>>C#>>正文


C# DocumentStore.GetProfilingInformationFor方法代码示例

本文整理汇总了C#中Raven.Client.Document.DocumentStore.GetProfilingInformationFor方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentStore.GetProfilingInformationFor方法的具体用法?C# DocumentStore.GetProfilingInformationFor怎么用?C# DocumentStore.GetProfilingInformationFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Client.Document.DocumentStore的用法示例。


在下文中一共展示了DocumentStore.GetProfilingInformationFor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnableProfiling

		public EnableProfiling()
		{
			using (var documentStore = new DocumentStore())
			{
				#region initialize_profiling
				documentStore.InitializeProfiling();
				#endregion

				Guid id = Guid.Empty;

				#region get_profiling_info
				ProfilingInformation profilingInformation = documentStore.GetProfilingInformationFor(id);
				#endregion

				#region example
				Guid sesionId;
				using (IDocumentSession session = documentStore.OpenSession())
				{
					sesionId = ((DocumentSession)session).Id;

					session.Load<Employee>("employees/1");
				}

				ProfilingInformation sessionProfilingInfo = documentStore.GetProfilingInformationFor(sesionId);
				#endregion
			}
		}
开发者ID:modulexcite,项目名称:docs-8,代码行数:27,代码来源:EnableProfiling.cs

示例2: CanTrackQueries

		public void CanTrackQueries()
		{
			using (GetNewServer())
			using (var store = new DocumentStore {Url = "http://localhost:8080"})
			{
				store.Initialize();
				// make the replication check here
				using (var session = store.OpenSession())
				{
					session.Load<User>("users/1");
				}

				Guid id;
				using (var session = store.OpenSession())
				{
					session.Query<User>().ToList();

					id = session.Advanced.DatabaseCommands.ProfilingInformation.Id;
				}

				var profilingInformation = store.GetProfilingInformationFor(id);

				Assert.Equal(1, profilingInformation.Requests.Count);
			}

		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:26,代码来源:Profiling.cs

示例3: CanProfileLazyRequests

		public void CanProfileLazyRequests()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();
				store.InitializeProfiling();
				using (var session = store.OpenSession())
				{
					// handle the initial request for replication information
				}
				Guid id;
				using (var session = store.OpenSession())
				{
					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
					session.Advanced.Lazily.Load<User>("users/1");
					session.Advanced.Lazily.Load<User>("users/2");
					session.Advanced.Lazily.Load<User>("users/3");

					session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
				}

				var profilingInformation = store.GetProfilingInformationFor(id);
				Assert.Equal(1, profilingInformation.Requests.Count);

				var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result, Default.Converters);
				Assert.Equal(3, responses.Length);
				foreach (var response in responses)
				{
					Assert.Equal(404, response.Status);
				}

			}
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:34,代码来源:MultiGetProfiling.cs

示例4: CanTrackLoadActions

		public void CanTrackLoadActions()
		{
			using(GetNewServer())
			using(var store = new DocumentStore{Url =  "http://localhost:8079"})
			{
				store.Conventions.DisableProfiling = false;
				store.Initialize();
				// make the replication check here
				using(var session = store.OpenSession())
				{
					session.Load<User>("users/1");
				}

				Guid id;
				using (var session = store.OpenSession())
				{
					session.Load<User>("users/1");

					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
				}

				var profilingInformation = store.GetProfilingInformationFor(id);

				Assert.Equal(1, profilingInformation.Requests.Count);
			}
		}
开发者ID:royra,项目名称:ravendb,代码行数:26,代码来源:Profiling.cs

示例5: CanProfilePartiallyCachedLazyRequest

		public void CanProfilePartiallyCachedLazyRequest()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Conventions.DisableProfiling = false; 
				store.Initialize();
				using (var session = store.OpenSession())
				{
					session.Store(new User { Name = "oren" });
					session.Store(new User { Name = "ayende" });
					session.SaveChanges();
				}


				using (var session = store.OpenSession())
				{
					session.Query<User>().Where(x => x.Name == "oren")
						.Customize(x => x.WaitForNonStaleResults())
						.ToArray();
				}
				Guid id;

				using (var session = store.OpenSession())
				{
					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
					session.Query<User>().Where(x => x.Name == "oren").Lazily();
					session.Query<User>().Where(x => x.Name == "ayende").Lazily();
					session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();

				}
				var profilingInformation = store.GetProfilingInformationFor(id);
				Assert.Equal(1, profilingInformation.Requests.Count);

				var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result, Default.Converters);
				Assert.Equal(304, responses[0].Status);
				Assert.Contains("oren", responses[0].Result.ToString());

				Assert.Equal(200, responses[1].Status);
				Assert.Contains("ayende", responses[1].Result.ToString());
			}
		}
开发者ID:shiranGinige,项目名称:ravendb,代码行数:42,代码来源:MultiGetProfiling.cs

示例6: CanProfilePartiallyAggressivelyCached

		public void CanProfilePartiallyAggressivelyCached()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();
				store.InitializeProfiling();
				using (var session = store.OpenSession())
				{
					session.Store(new User { Name = "oren" });
					session.Store(new User { Name = "ayende" });
					session.SaveChanges();
				}


				using (var session = store.OpenSession())
				{
					using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
					{
						session.Load<User>("users/1");
					}
				}
				Guid id;

				using (var session = store.OpenSession())
				{
					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
					using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
					{
						session.Advanced.Lazily.Load<User>("users/1");
						session.Advanced.Lazily.Load<User>("users/2");

						session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
					}

				}
				var profilingInformation = store.GetProfilingInformationFor(id);
				Assert.Equal(1, profilingInformation.Requests.Count);

				var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result, Default.Converters);
				Assert.Equal(0, responses[0].Status);
				Assert.Contains("oren", responses[0].Result.ToString());

				Assert.Equal(200, responses[1].Status);
				Assert.Contains("ayende", responses[1].Result.ToString());
			}
		}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:47,代码来源:MultiGetProfiling.cs

示例7: CanProfileErrors

		public void CanProfileErrors()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();
				using (var session = store.OpenSession())
				{
					session.Store(new User { Name = "oren" });
					session.Store(new User { Name = "ayende" });
					session.SaveChanges();
				}


				Guid id;

				using (var session = store.OpenSession())
				{
					id = session.Advanced.DatabaseCommands.ProfilingInformation.Id;
					session.Advanced.LuceneQuery<object, RavenDocumentsByEntityName>().WhereEquals("Not", "There").Lazily();
					Assert.Throws<InvalidOperationException>(() => session.Advanced.Eagerly.ExecuteAllPendingLazyOperations());
				}
				var profilingInformation = store.GetProfilingInformationFor(id);
				Assert.Equal(1, profilingInformation.Requests.Count);

				var responses = JsonConvert.DeserializeObject<GetResponse[]>(profilingInformation.Requests[0].Result);
				Assert.Equal(500, responses[0].Status);
				Assert.Contains("The field 'Not' is not indexed, cannot query on fields that are not indexed", responses[0].Result);
			}
		}
开发者ID:runesoerensen,项目名称:ravendb,代码行数:30,代码来源:MultiGetProfiling.cs

示例8: CanTrackPosts

		public void CanTrackPosts()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" })
			{
				store.Initialize();
				store.InitializeProfiling();
				
				// make hilo & replication checks here
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.SaveChanges();
				}

				Guid id;
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.SaveChanges();

					id = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
				}

				var profilingInformation = store.GetProfilingInformationFor(id);

				
				Assert.Equal(1, profilingInformation.Requests.Count);
			}
		}
开发者ID:925coder,项目名称:ravendb,代码行数:30,代码来源:Profiling.cs


注:本文中的Raven.Client.Document.DocumentStore.GetProfilingInformationFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。