Beispiel #1
0
        public async Task <IPageResult <T> > FindEntriesAsync()
        {
            var annotations = new ODataFeedAnnotations();
            var results     = await _client.FindEntriesAsync(annotations);

            return(new PageResult <T>(results, annotations));
        }
Beispiel #2
0
        protected virtual async Task <IEnumerable <T> > GetAllRecordsAsync <T>(IBoundClient <T> query) where T : class
        {
            var annotations = new ODataFeedAnnotations();
            var entities    = await query.FindEntriesAsync(annotations);

            var result = entities.ToList();

            while (annotations.NextPageLink != null)
            {
                entities = await query.FindEntriesAsync(annotations.NextPageLink, annotations);

                result.AddRange(entities);
            }

            return(result);
        }
        public static async Task <IEnumerable <T> > FindEntriesWithLogsAsync <T>(this IBoundClient <T> boundClient, ILogger logger, bool resultRequired = true) where T : class, IDynamicsEntity
        {
            logger.LogInformation($"Executing Dynamics Query: {await boundClient.GetCommandTextAsync()}");
            var result = await boundClient.FindEntriesAsync(resultRequired);

            return(result);
        }
        public async Task <IEnumerable <T> > ResultAsync(Expression <Func <T, bool> > expression)
        {
            try
            {
                bounder = bounder.Filter(expression);
                var result = await bounder.FindEntriesAsync();

                Dispose();
                return(result);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
        public async Task <IEnumerable <T> > ResultAsync()
        {
            try
            {
                var command = await bounder.GetCommandTextAsync();

                var result = await bounder.FindEntriesAsync();

                Dispose();
                return(result);
            }
            catch (Exception ex)
            {
                //throw new Exception("ClientService Exception", ex);
                Console.WriteLine(ex.Message);
                return(null);
            }
        }