コード例 #1
0
        public Task<FindResults<User>> GetByOrganizationIdAsync(string organizationId, CommandOptionsDescriptor<User> options = null) {
            if (String.IsNullOrEmpty(organizationId))
                return Task.FromResult<FindResults<User>>(new FindResults<User>());

            var commandOptions = options.Configure();
            if (commandOptions.ShouldUseCache())
                throw new Exception("Caching of paged queries is not allowed");

            var filter = Query<User>.Term(u => u.OrganizationIds, organizationId);
            return FindAsync(q => q.ElasticFilter(filter).SortAscending(u => u.EmailAddress.Suffix("keyword")), o => commandOptions);
        }
コード例 #2
0
        public Task <FindResults <Employee> > GetAllByCompanyAsync(string company, CommandOptionsDescriptor <Employee> options = null)
        {
            var commandOptions = options.Configure();

            if (commandOptions.ShouldUseCache())
            {
                commandOptions.CacheKey(company);
            }

            return(FindAsync(q => q.Company(company), o => commandOptions));
        }
コード例 #3
0
        public virtual Task <FindResults <T> > GetByOrganizationIdAsync(string organizationId, CommandOptionsDescriptor <T> options = null)
        {
            if (String.IsNullOrEmpty(organizationId))
            {
                throw new ArgumentNullException(nameof(organizationId));
            }

            var commandOptions = options.Configure();

            if (commandOptions.ShouldUseCache())
            {
                throw new Exception("Caching of paged queries is not allowed");
            }

            return(FindAsync(new RepositoryQuery <T>().Organization(organizationId), commandOptions));
        }
コード例 #4
0
        public Task <FindResults <User> > GetByOrganizationIdAsync(string organizationId, CommandOptionsDescriptor <User> options = null)
        {
            if (String.IsNullOrEmpty(organizationId))
            {
                return(Task.FromResult <FindResults <User> >(new FindResults <User>()));
            }

            var commandOptions = options.Configure();

            if (commandOptions.ShouldUseCache())
            {
                commandOptions.CacheKey(String.Concat("paged:Organization:", organizationId));
            }

            var filter = Query <User> .Term(u => u.OrganizationIds, organizationId);

            return(FindAsync(q => q.ElasticFilter(filter).SortAscending(u => u.EmailAddress.Suffix("keyword")), o => commandOptions));
        }
コード例 #5
0
        public Task <FindResults <Project> > GetByOrganizationIdsAsync(ICollection <string> organizationIds, CommandOptionsDescriptor <Project> options = null)
        {
            if (organizationIds == null)
            {
                throw new ArgumentNullException(nameof(organizationIds));
            }

            if (organizationIds.Count == 0)
            {
                return(Task.FromResult(new FindResults <Project>()));
            }

            if (organizationIds.Count == 1)
            {
                var commandOptions = options.Configure();
                return(GetByOrganizationIdAsync(organizationIds.First(), o => commandOptions.Cache()));
            }

            return(FindAsync(q => q.Organizations(organizationIds), options));
        }
 public Task <FindResults <T> > GetAllAsync(CommandOptionsDescriptor <T> options)
 {
     return(GetAllAsync(options.Configure()));
 }
コード例 #7
0
 public static Task <IReadOnlyCollection <T> > GetByIdsAsync <T>(this IReadOnlyRepository <T> repository, Ids ids, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.GetByIdsAsync(ids, options.Configure()));
 }
コード例 #8
0
 public static Task InvalidateCacheAsync <T>(this IReadOnlyRepository <T> repository, IEnumerable <T> documents, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.InvalidateCacheAsync(documents, options.Configure()));
 }
 public Task <CountResult> CountAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(CountAsync(query.Configure(), options.Configure()));
 }
 public static Task <FindResults <T> > SearchAsync <T>(this ISearchableReadOnlyRepository <T> repository, ISystemFilter systemFilter, string filter = null, string criteria = null, string sort = null, string aggregations = null, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.SearchAsync(systemFilter, filter, criteria, sort, aggregations, options.Configure()));
 }
 public static Task <CountResult> CountBySearchAsync <T>(this ISearchableReadOnlyRepository <T> repository, ISystemFilter systemFilter, string filter = null, string aggregations = null, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.CountBySearchAsync(systemFilter, filter, aggregations, options.Configure()));
 }
 public Task <T> GetByIdAsync(Id id, CommandOptionsDescriptor <T> options)
 {
     return(GetByIdAsync(id, options.Configure()));
 }
 public Task <bool> ExistsAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(ExistsAsync(query.Configure(), options.Configure()));
 }
 public Task <long> CountAsync(CommandOptionsDescriptor <T> options)
 {
     return(CountAsync(options.Configure()));
 }
 public Task <bool> ExistsAsync(Id id, CommandOptionsDescriptor <T> options)
 {
     return(ExistsAsync(id, options.Configure()));
 }
 public Task <FindResults <T> > FindAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(FindAsAsync <T>(query.Configure(), options.Configure()));
 }
コード例 #17
0
 public static Task <T> SaveAsync <T>(this IRepository <T> repository, T document, CommandOptionsDescriptor <T> options = null) where T : class, IIdentity, new()
 {
     return(repository.SaveAsync(document, options.Configure()));
 }
 public Task <FindResults <TResult> > FindAsAsync <TResult>(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null) where TResult : class, new()
 {
     return(FindAsAsync <TResult>(query.Configure(), options.Configure()));
 }
コード例 #19
0
 public static Task PatchAsync <T>(this IRepository <T> repository, Ids ids, IPatchOperation operation, CommandOptionsDescriptor <T> options = null) where T : class, IIdentity, new()
 {
     return(repository.PatchAsync(ids, operation, options.Configure()));
 }
コード例 #20
0
 public static Task <long> CountAsync <T>(this IReadOnlyRepository <T> repository, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.CountAsync(options.Configure()));
 }
コード例 #21
0
 public static Task RemoveAsync <T>(this IRepository <T> repository, IEnumerable <T> documents, CommandOptionsDescriptor <T> options = null) where T : class, IIdentity, new()
 {
     return(repository.RemoveAsync(documents, options.Configure()));
 }
コード例 #22
0
 public static Task <FindResults <T> > GetAllAsync <T>(this IReadOnlyRepository <T> repository, CommandOptionsDescriptor <T> options = null) where T : class, new()
 {
     return(repository.GetAllAsync(options.Configure()));
 }
コード例 #23
0
 public static Task <long> RemoveAllAsync <T>(this IRepository <T> repository, CommandOptionsDescriptor <T> options = null) where T : class, IIdentity, new()
 {
     return(repository.RemoveAllAsync(options.Configure()));
 }
コード例 #24
0
 public virtual Task <FindHit <T> > FindOneAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(FindOneAsync(query.Configure(), options.Configure()));
 }
 public Task <IReadOnlyCollection <T> > GetByIdsAsync(Ids ids, CommandOptionsDescriptor <T> options)
 {
     return(GetByIdsAsync(ids, options.Configure()));
 }