internal static string Build(TablePaginationToken token, TableQueryOptions options)
        {
            if (token == null && options == null)
            {
                return(null);
            }

            var result = Quote;

            if (token != null)
            {
                result += "NextPartitionKey=" + Uri.EscapeDataString(token.NextPartitionKey) + "&NextRowKey=" + Uri.EscapeDataString(token.NextRowKey);
            }

            if (options == null)
            {
                return(result);
            }

            if (options.Top > 0)
            {
                result  = Result(result);
                result += "$top=" + options.Top.ToString(CultureInfo.InvariantCulture);
            }

            if (!string.IsNullOrEmpty(options.SelectProperties))
            {
                result  = Result(result);
                result += "$select=" + options.SelectProperties;
            }

            if (options.Filters?.Length > 0)
            {
                result  = Result(result);
                result += "$filter=" + BuildFilterCondition(options.Filters);
            }

            string Result(string s)
            {
                if (s.IndexOf('?') == -1)
                {
                    s += Quote;
                }
                else if (s == "?")
                {
                    return(s);
                }
                else
                {
                    s += "&";
                }
                return(s);
            }

            return(result);
        }
Exemple #2
0
        public TableQueryResult(List <T> result, TablePaginationToken paginationToken)
        {
            Results = result;

            TablePaginationToken = paginationToken;
        }
 internal static TableOperation Get(ITableEntity entity, TableQueryOptions options = null, TablePaginationToken token = null) => new TableOperation(entity, TableOperationType.Get, token, options);
 public Task <TableQueryResult <T> > QueryAsync <T>(ITableEntity entity, TablePaginationToken token, TableQueryOptions options) where T : class
 {
     return(TableOperation.Get(entity, options, token).ExecuteQueryAsync <T>(_credentials, _tableStorageUri));
 }
        internal TableOperation(ITableEntity entity, TableOperationType operationType, TablePaginationToken token, TableQueryOptions options)
        {
            _entity = entity;

            _operationType = operationType;

            _tableUri = new TableUri(entity, operationType, TableUriQueryBuilder.Build(token, options));

            if (operationType == TableOperationType.InsertEdmType)
            {
                _edmTypeEntity = EntityPropertyBuilder.Build(entity);
            }
        }