Exemplo n.º 1
0
 /// <summary>
 /// Gets the first entity with the specified criteria.
 /// </summary>
 /// <param name="filterCriteria"></param>
 /// <returns></returns>
 public Entity Single(EntityFilterCriteria filterCriteria)
 {
     return(ListEntities(new EntityFilterCriteria
     {
         Path = filterCriteria.Path,
         Namespace = filterCriteria.Namespace,
         NamespaceMatchType = filterCriteria.NamespaceMatchType,
         Top = 1,
         Skip = filterCriteria.Skip
     })
            .FirstOrDefault());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the total number of entities of the specified namespace contained in the specified path.
        /// </summary>
        public int CountEntities(EntityFilterCriteria filterCriteria)
        {
            int result;

            if (filterCriteria.Path == null)
            {
                var documentStore = this.Configuration.GetDocumentStore <IFolderCapableDocumentStore>();
                result = documentStore.CountEntities(this.Configuration.ContainerTitle, filterCriteria.Path, filterCriteria);
            }
            else
            {
                var documentStore = this.Configuration.GetDocumentStore <IDocumentStore>();
                result = documentStore.CountEntities(this.Configuration.ContainerTitle, filterCriteria);
            }

            return(result);
        }