Execute() public method

public Execute ( string>.IEnumerable parameters ) : System.Xml.Linq.XElement
parameters string>.IEnumerable
return System.Xml.Linq.XElement
Exemplo n.º 1
0
        public void GetInfo(out long itemCount, out long sizeBytes)
        {
            XElement responseElement = _service.Execute(new DomainMetadataBuilder(_domainName));

            itemCount = long.Parse(responseElement.Descendants(Sdb + "ItemCount").First().Value);
            sizeBytes =
                long.Parse(responseElement.Descendants(Sdb + "ItemNamesSizeBytes").First().Value) +
                long.Parse(responseElement.Descendants(Sdb + "AttributeNamesSizeBytes").First().Value) +
                long.Parse(responseElement.Descendants(Sdb + "AttributeValuesSizeBytes").First().Value);
        }
Exemplo n.º 2
0
        private static IEnumerable <XElement> SelectElements(SdbService service, string selectExpression, bool withConsistency)
        {
            string nextToken = null;

            do
            {
                XElement responseElement = service.Execute(
                    new SelectBuilder(selectExpression, nextToken, withConsistency));

                foreach (XElement itemElement in responseElement.Descendants(Sdb + "Item"))
                {
                    yield return(itemElement);
                }

                XElement nextTokenElement = responseElement.Descendants(Sdb + "NextToken").FirstOrDefault();

                if (nextTokenElement == null)
                {
                    nextToken = null;
                }
                else
                {
                    nextToken = nextTokenElement.Value;
                }
            }while (nextToken != null);
        }
Exemplo n.º 3
0
        public static IEnumerable <SdbTable> ListTables(string serviceId, string serviceSecret, bool withConsistency, int?selectLimit)
        {
            SdbService service         = new SdbService(serviceId, serviceSecret);
            XElement   responseElement = service.Execute(new ListDomainsBuilder());

            foreach (string domainName in responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value))
            {
                yield return(new SdbTable(service, domainName, withConsistency, selectLimit));
            }
        }
Exemplo n.º 4
0
        public static bool TryCreate(string serviceId, string serviceSecret, string domainName, bool withConsistency, int?selectLimit, bool ensureDomain, out SdbTable table)
        {
            SdbService service         = new SdbService(serviceId, serviceSecret);
            XElement   responseElement = service.Execute(new ListDomainsBuilder());

            if (responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value).Contains(domainName))
            {
                table = new SdbTable(service, domainName, withConsistency, selectLimit);
                return(true);
            }

            if (ensureDomain)
            {
                table = Create(service, domainName, withConsistency, selectLimit);
                return(true);
            }

            table = null;
            return(false);
        }
Exemplo n.º 5
0
 private static SdbTable Create(SdbService service, string domainName, bool withConsistency, int?selectLimit)
 {
     service.Execute(new CreateDomainBuilder(domainName));
     return(new SdbTable(service, domainName, withConsistency, selectLimit));
 }
Exemplo n.º 6
0
        private static IEnumerable<XElement> SelectElements(SdbService service, string selectExpression, bool withConsistency)
        {
            string nextToken = null;

            do
            {
                XElement responseElement = service.Execute(
                    new SelectBuilder(selectExpression, nextToken, withConsistency));

                foreach (XElement itemElement in responseElement.Descendants(Sdb + "Item"))
                {
                    yield return itemElement;
                }

                XElement nextTokenElement = responseElement.Descendants(Sdb + "NextToken").FirstOrDefault();

                if (nextTokenElement == null)
                {
                    nextToken = null;
                }
                else
                {
                    nextToken = nextTokenElement.Value;
                }
            }
            while (nextToken != null);
        }
Exemplo n.º 7
0
 private static SdbTable Create(SdbService service, string domainName, bool withConsistency, int? selectLimit)
 {
     service.Execute(new CreateDomainBuilder(domainName));
     return new SdbTable(service, domainName, withConsistency, selectLimit);
 }
Exemplo n.º 8
0
        public static bool TryCreate(string serviceId, string serviceSecret, string domainName, bool withConsistency, int? selectLimit, bool ensureDomain, out SdbTable table)
        {
            SdbService service = new SdbService(serviceId, serviceSecret);
            XElement responseElement = service.Execute(new ListDomainsBuilder());

            if (responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value).Contains(domainName))
            {
                table = new SdbTable(service, domainName, withConsistency, selectLimit);
                return true;
            }

            if (ensureDomain)
            {
                table = Create(service, domainName, withConsistency, selectLimit);
                return true;
            }

            table = null;
            return false;
        }
Exemplo n.º 9
0
        public static IEnumerable<SdbTable> ListTables(string serviceId, string serviceSecret, bool withConsistency, int? selectLimit)
        {
            SdbService service = new SdbService(serviceId, serviceSecret);
            XElement responseElement = service.Execute(new ListDomainsBuilder());

            foreach (string domainName in responseElement.Descendants(Sdb + "DomainName").Select(n => n.Value))
            {
                yield return new SdbTable(service, domainName, withConsistency, selectLimit);
            }
        }