Example #1
0
        public async Task <IResultList <IContentEntity> > QueryAsync(IAppEntity app, List <ISchemaEntity> schemas, Q q,
                                                                     CancellationToken ct)
        {
            using (Telemetry.Activities.StartActivity("MongoContentCollection/QueryAsync"))
            {
                if (q.Ids != null && q.Ids.Count > 0)
                {
                    return(await queryByIds.QueryAsync(app.Id, schemas, q, ct));
                }

                if (q.ScheduledFrom != null && q.ScheduledTo != null)
                {
                    return(await queryScheduled.QueryAsync(app.Id, schemas, q, ct));
                }

                if (q.Referencing != default)
                {
                    return(await queryReferences.QueryAsync(app.Id, schemas, q, ct));
                }

                if (q.Reference != default)
                {
                    return(await queryByQuery.QueryAsync(app, schemas, q, ct));
                }

                return(ResultList.CreateFrom <IContentEntity>(0));
            }
        }
        public async Task <IResultList <IContentEntity> > QueryAsync(IAppEntity app, List <ISchemaEntity> schemas, Q q)
        {
            using (Profiler.TraceMethod <MongoContentRepository>())
            {
                if (q.Ids != null && q.Ids.Count > 0)
                {
                    return(await queryByIds.QueryAsync(app.Id, schemas, q));
                }

                if (q.Referencing != default)
                {
                    return(await queryReferences.QueryAsync(app.Id, schemas, q));
                }

                if (q.Reference != default)
                {
                    return(await queryByQuery.QueryAsync(app, schemas, q));
                }

                return(ResultList.CreateFrom <IContentEntity>(0));
            }
        }