Execute() 공개 메소드

public Execute ( string>.IEnumerable parameters ) : System.Xml.Linq.XElement
parameters string>.IEnumerable
리턴 System.Xml.Linq.XElement
예제 #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);
        }
예제 #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);
        }
예제 #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));
            }
        }
예제 #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);
        }
예제 #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));
 }
예제 #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);
        }
예제 #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);
 }
예제 #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;
        }
예제 #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);
            }
        }