本文整理汇总了C#中Raven.Client.Document.DocumentStore.InitializeProfiling方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentStore.InitializeProfiling方法的具体用法?C# DocumentStore.InitializeProfiling怎么用?C# DocumentStore.InitializeProfiling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Client.Document.DocumentStore
的用法示例。
在下文中一共展示了DocumentStore.InitializeProfiling方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
示例3: CanTrackQueries
public void CanTrackQueries()
{
using (GetNewServer())
using (var store = new DocumentStore {Url = "http://localhost:8079"})
{
store.Initialize();
store.InitializeProfiling();
// 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 = ((DocumentSession)session).DatabaseCommands.ProfilingInformation.Id;
}
var profilingInformation = store.GetProfilingInformationFor(id);
Assert.Equal(1, profilingInformation.Requests.Count);
}
}
示例4: 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
}
}
示例5: CanProfilePartiallyCachedLazyRequest
public void CanProfilePartiallyCachedLazyRequest()
{
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())
{
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());
}
}
示例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());
}
}
示例7: CanProfileErrors
public void CanProfileErrors()
{
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();
}
Guid id;
using (var session = store.OpenSession())
{
id = ((DocumentSession)session).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, Default.Converters);
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.ToString());
}
}