Ejemplo n.º 1
0
        private static void Callback(object obj)
        {
            ThreadStack ts = (ThreadStack)obj;
            //System.Console.WriteLine("Started task " + ts.Idx);

            TableEntity te = new TableEntity() { PartitionKey = "00", RowKey = DateTime.Now.Ticks.ToString() + ts.Idx.ToString() };
            te.Attributes.Add("DateTime", DateTime.Now.ToLongTimeString());
            te.Attributes.Add("Hostname", System.Net.Dns.GetHostName());
            te.Attributes.Add("Row", ts.Row);

            ts.Table.InsertOrUpdate(te);

            //System.Console.WriteLine("Ended task " + ts.Idx);

            ts.mre.Set();
        }
Ejemplo n.º 2
0
        internal List<TableEntity> _QueryInternal(
            string NextPartitionKey,
            string NextRowKey,
            out string continuationNextPartitionKey,
            out string continuationNextRowKey,
            string xmsclientrequestId = null)
        {
            List<TableEntity> lEntities = new List<TableEntity>();

            string res = ITPCfSQL.Azure.Internal.InternalMethods.QueryTable(
                AzureTableService.UseHTTPS, AzureTableService.SharedKey, AzureTableService.AccountName, this.Name,
                NextPartitionKey, NextRowKey,
                out continuationNextPartitionKey, out continuationNextRowKey,
                xmsclientrequestId);

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

            using (System.IO.StringReader sr = new System.IO.StringReader(res))
            {
                using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(sr))
                {
                    doc.Load(reader);
                }
            }

            System.Xml.XmlNamespaceManager man = new System.Xml.XmlNamespaceManager(doc.NameTable);
            man.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices");
            man.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
            man.AddNamespace("f", "http://www.w3.org/2005/Atom");

            foreach (System.Xml.XmlNode node in doc.SelectNodes("f:feed/f:entry", man))
            {
                System.Xml.XmlNode nCont = node.SelectSingleNode("f:content/m:properties", man);
                System.Xml.XmlNode nTimeStamp = nCont.SelectSingleNode("d:Timestamp", man);
                TableEntity te = new TableEntity()
                    {
                        PartitionKey = nCont.SelectSingleNode("d:PartitionKey", man).InnerText,
                        RowKey = nCont.SelectSingleNode("d:RowKey", man).InnerText,
                        TimeStamp = DateTime.Parse(nTimeStamp.InnerText)
                    };

                // custom attrib handling
                System.Xml.XmlNode nFollow = nTimeStamp.NextSibling;
                while (nFollow != null)
                {
                    te.Attributes[nFollow.LocalName] = nFollow.InnerText;
                    nFollow = nFollow.NextSibling;
                }

                lEntities.Add(te);

            }
            return lEntities;
        }
Ejemplo n.º 3
0
 public void InsertOrUpdate(TableEntity te, string xmsclientrequestId = null)
 {
     ITPCfSQL.Azure.Internal.InternalMethods.InsertOrReplaceTableEntity(
          AzureTableService.AccountName, AzureTableService.SharedKey, AzureTableService.UseHTTPS, this.Name, te, xmsclientrequestId);
 }
Ejemplo n.º 4
0
 public void Delete(TableEntity te, string xmsclientrequestId = null)
 {
     ITPCfSQL.Azure.Internal.InternalMethods.DeleteEntity(
         AzureTableService.AccountName, AzureTableService.SharedKey, AzureTableService.UseHTTPS, this.Name, te, xmsclientrequestId);
 }