本文整理汇总了C#中IDocumentStore.QuerySession方法的典型用法代码示例。如果您正苦于以下问题:C# IDocumentStore.QuerySession方法的具体用法?C# IDocumentStore.QuerySession怎么用?C# IDocumentStore.QuerySession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocumentStore
的用法示例。
在下文中一共展示了IDocumentStore.QuerySession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUsers
private UserWithGuid[] GetUsers(IDocumentStore documentStore)
{
using (var session = documentStore.QuerySession())
{
return session.Query<UserWithGuid>().ToArray();
}
}
示例2: searching
public void searching(IDocumentStore store)
{
using (var session = store.QuerySession())
{
session.Query<ClassWithChildCollections>()
// Where collections of deep objects
.Where(x => x.Companies.Any(_ => _.Name == "Jeremy"))
// Where for Contains() on array of simple types
.Where(x => x.Names.Contains("Corey"))
// Where for Contains() on List<T> of simple types
.Where(x => x.NameList.Contains("Phillip"))
// Where for Contains() on IList<T> of simple types
.Where(x => x.NameList2.Contains("Jens"))
// Where for Any(element == value) on simple types
.Where(x => x.Names.Any(_ => _ == "Phillip"));
}
}
示例3: fetchProjects
private static IDictionary<string, ActiveProject> fetchProjects(IDocumentStore store)
{
var dict = new Dictionary<string, ActiveProject>();
using (var session = store.QuerySession())
{
session.Query<ActiveProject>().ToList().Each(proj => dict.Add(proj.ProjectName, proj));
}
return dict;
}