Ejemplo n.º 1
0
        /// <inheritdoc/>
        public virtual Task <Entity> RetrieveAsync(string entityName, Guid id, [AllowNull] QueryOptions options = null,
                                                   CancellationToken cancellationToken = default)
        {
            var requestId = Guid.NewGuid();

            var queryString = (options ?? new QueryOptions()).BuildQueryString(WebApiMetadata, entityName);

            var entityMd = WebApiMetadata.GetEntityMetadata(entityName);

            var request = $"{entityMd.EntitySetName}({id}){queryString}";

            return(GetAsync <Entity>(request, requestId, cancellationToken));
        }
Ejemplo n.º 2
0
        public virtual Task <EntityCollection> RetrieveMultipleAsync(FetchXmlExpression fetchXml,
                                                                     CancellationToken cancellationToken = default)
        {
            if (fetchXml is null)
            {
                throw new ArgumentNullException(nameof(fetchXml));
            }

            var entityMetadata = WebApiMetadata.GetEntityMetadata(fetchXml.EntityName);

            var query = $"{entityMetadata.EntitySetName}?fetchXml={System.Net.WebUtility.UrlEncode(fetchXml)}";

            return(ExecuteFunctionAsync <EntityCollection>(query, cancellationToken));
        }
Ejemplo n.º 3
0
        public virtual Task <EntityCollection> RetrieveMultipleAsync(string entityName,
                                                                     [AllowNull] QueryOptions options    = null,
                                                                     CancellationToken cancellationToken = default)
        {
            _logger.LogInformation($"Start RetrieveMultipleAsync at {entityName}");

            var queryString = (options ?? new QueryOptions())
                              .BuildQueryString(WebApiMetadata, entityName);

            var entityMd = WebApiMetadata.GetEntityMetadata(entityName);

            var request = $"{entityMd.EntitySetName}{queryString}";

            return(ExecuteFunctionAsync <EntityCollection>(request, cancellationToken));
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public virtual Task <EntityCollection> RetrieveMultipleAsync(string entityName,
                                                                     [AllowNull] QueryOptions options    = null,
                                                                     CancellationToken cancellationToken = default)
        {
            _logger.LogDebug("Starting {WebApiOperationName} at {TargetEntity}",
                             "RetrieveMultiple", entityName);

            var requestId = Guid.NewGuid();

            var queryString = (options ?? new QueryOptions())
                              .BuildQueryString(WebApiMetadata, entityName);

            var entityMd = WebApiMetadata.GetEntityMetadata(entityName);

            var request = $"{entityMd.EntitySetName}{queryString}";

            return(GetAsync <EntityCollection>(request, requestId, cancellationToken));
        }
Ejemplo n.º 5
0
        public virtual Task <Entity> RetrieveAsync(string entityName, Guid id, [AllowNull] QueryOptions options = null,
                                                   CancellationToken cancellationToken = default)
        {
            _logger.LogInformation($"Start RetrieveAsync at {entityName} with id = {id}");

            var queryString = (options ?? new QueryOptions())
                              .BuildQueryString(WebApiMetadata, entityName);

            var entityMd = WebApiMetadata.GetEntityMetadata(entityName);

            var request = $"{entityMd.EntitySetName}({id}){queryString}";


            var entity = ExecuteFunctionAsync <Entity>(request, cancellationToken);

            _logger.LogInformation($"Finish RetrieveAsync at {entityName} with id = {id}");

            return(entity);
        }