Esempio n. 1
0
        public static TQuery ChildQuery <TQuery>(this TQuery query, RepositoryQueryDescriptor childQuery) where TQuery : IRepositoryQuery
        {
            if (childQuery == null)
            {
                throw new ArgumentNullException(nameof(childQuery));
            }

            var q = childQuery.Configure();

            if (q.GetDocumentType() == typeof(object))
            {
                throw new ArgumentException("DocumentType must be set on child queries", nameof(childQuery));
            }

            return(query.AddCollectionOptionValue(ChildQueriesKey, childQuery.Configure()));
        }
Esempio n. 2
0
        public static T ParentQuery <T>(this T query, RepositoryQueryDescriptor parentQuery) where T : IRepositoryQuery
        {
            if (parentQuery == null)
            {
                throw new ArgumentNullException(nameof(parentQuery));
            }

            return(query.AddCollectionOptionValue(ParentQueriesKey, parentQuery.Configure()));
        }
Esempio n. 3
0
        public static IRepositoryQuery <TChild> ParentQuery <TChild, TParent>(this IRepositoryQuery <TChild> query, RepositoryQueryDescriptor <TParent> parentQuery) where TChild : class where TParent : class
        {
            if (parentQuery == null)
            {
                throw new ArgumentNullException(nameof(parentQuery));
            }

            return(query.BuildOption(ParentQueryKey, parentQuery.Configure()));
        }
        public static T ChildQuery <T>(this T query, TypeName childType, RepositoryQueryDescriptor childQuery) where T : IRepositoryQuery
        {
            if (childType == null)
            {
                throw new ArgumentNullException(nameof(childType));
            }
            if (childQuery == null)
            {
                throw new ArgumentNullException(nameof(childQuery));
            }

            return(query.BuildOption(ChildQueryKey, new ChildQuery {
                Type = childType, Query = childQuery.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()));
 }
 public Task <CountResult> CountAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(CountAsync(query.Configure(), options.Configure()));
 }
 public Task <FindResults <T> > FindAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(FindAsAsync <T>(query.Configure(), options.Configure()));
 }
 public Task <bool> ExistsAsync(RepositoryQueryDescriptor <T> query)
 {
     return(ExistsAsync(query.Configure()));
 }
Esempio n. 9
0
 public Task <FindResults <Stack> > GetIdsByQueryAsync(RepositoryQueryDescriptor <Stack> query, CommandOptionsDescriptor <Stack> options = null)
 {
     return(FindAsync(q => query.Configure().OnlyIds(), options));
 }
 public virtual Task <FindHit <T> > FindOneAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(FindOneAsync(query.Configure(), options.Configure()));
 }
 public Task <bool> ExistsAsync(RepositoryQueryDescriptor <T> query, CommandOptionsDescriptor <T> options = null)
 {
     return(ExistsAsync(query.Configure(), options.Configure()));
 }