当前位置: 首页>>代码示例>>C#>>正文


C# CloudTable.ExecuteQuery方法代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:C# CloudTable.ExecuteQuery方法的具体用法?C# CloudTable.ExecuteQuery怎么用?C# CloudTable.ExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAzure.Storage.Table.CloudTable的用法示例。


在下文中一共展示了CloudTable.ExecuteQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Search

        private static void Search(CloudTable table)
        {
            TableQuery<TableChat> query =
                new TableQuery<TableChat>().Where(TableQuery.GenerateFilterCondition("user",
                    QueryComparisons.Equal, "Tzkwizard"));

            // Print the fields for each customer.
            foreach (TableChat entity in table.ExecuteQuery(query))
            {
                Console.WriteLine("{0}, {1} {2} {3} {4}", entity.PartitionKey, entity.RowKey,
                    entity.roomName, entity.uid, entity.message);
            }
        }
开发者ID:tzkwizard,项目名称:ELS,代码行数:13,代码来源:ChatBackup.cs

示例2: RetrieveSessions

        private static void RetrieveSessions(CloudTable table)
        {
            var startsAt = new DateTime(2016, 10, 4, 12, 0, 0);
            // Construct the query operation for all sessions for the first day of the TechDays event.
            TableQuery<Session> query = new TableQuery<Session>()
                .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, startsAt.Date.ToString("s")));

            // Print the fields for each session.
            foreach (Session entity in table.ExecuteQuery(query))
            {
                Console.WriteLine($"Day: {entity.PartitionKey}, ID:{entity.RowKey}\tName:{entity.Name}\tDescription{entity.Description}");
            }
        }
开发者ID:XpiritBV,项目名称:mini-hacks,代码行数:13,代码来源:Program.cs

示例3: DashboardUpdate

        public DashboardUpdate(CloudTable generalInfoTable, CloudTable pageTable, CloudTable errorTable, CloudTable mappingTable, CloudQueue urlQ)
        {
            this.dashboardTable = generalInfoTable;
            this.pageTable = pageTable;
            this.errorTable = errorTable;
            this.mappingTable = mappingTable;
            this.urlQ = urlQ;

            IEnumerator<Dashboard> results = generalInfoTable.ExecuteQuery(new TableQuery<Dashboard>()).GetEnumerator();
            if (!results.MoveNext())
            {
                generalInfoTable.Execute(TableOperation.InsertOrReplace(new Dashboard(0, 0, 0, new List<string>(), new List<string>())));
            }
        }
开发者ID:kxchiu,项目名称:INFO344,代码行数:14,代码来源:[PA+4]+DashboardUpdate.cs

示例4: GetLogs

        private static string GetLogs(CloudTable table)
        {
            var query = new TableQuery<LogEntity>()
                .Where(TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.GreaterThan, _lastQuery));

            var sb = new StringBuilder();
            foreach (LogEntity entry in table.ExecuteQuery(query))
            {
                sb.Append(entry.Message)
                    .Append(", ")
                    .Append(entry.Timestamp)
                    .AppendLine();
                _lastQuery = entry.Timestamp;
            }

            return sb.ToString();
        }
开发者ID:kunzimariano,项目名称:SumoLogic.Sample,代码行数:17,代码来源:Program.cs

示例5: searchMainTableOCR

        public void searchMainTableOCR(CloudTable mainbl, ref List<TableKeys> results, string keyword)
        {

            int rank = 1;

            var sortedList = from p in results
                             orderby p.Counter descending
                             select p;
            //sortedList.ToList().ForEach(p => Console.WriteLine(p.Counter));

            Console.WriteLine("");

            foreach (var v in sortedList)
            {
                

                string finalPK = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, v.PartitionKey);
                string finalRK = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, v.RowKey);

                TableQuery<BookEntity> finalquery = new TableQuery<BookEntity>().Where(TableQuery.CombineFilters(finalPK, TableOperators.And, finalRK));

                var finallist = mainbl.ExecuteQuery(finalquery).ToList();

                foreach (var vv in finallist)
                {
                    Console.WriteLine("{0} {1}", rank, vv.title);
                    Console.WriteLine("by {0} ", vv.publisher);
                    Console.WriteLine(vv.place);
                    Console.WriteLine("The Keyword '{0}' was found {1} times", keyword, v.Counter);
                    Console.WriteLine();
                    rank += 1;
                }

            }

        }
开发者ID:BL-publicdomain,项目名称:blpublicdomain,代码行数:36,代码来源:AzureStorageController.cs

示例6: queryForPlaceSimple

        public void queryForPlaceSimple(CloudTable placebl, ref List<TableKeys> results, string keyword)
        {

            //split user-query into array
            string[] words = keyword.Split();
            int counterOfKeyword = words.Count();



            TableQuery<PlaceEntity> queryPlaces =
       new TableQuery<PlaceEntity>()
          .Where(TableQuery.GenerateFilterCondition("PartitionKey",
              QueryComparisons.GreaterThanOrEqual, " "));

            var listOfPlaces = placebl.ExecuteQuery(queryPlaces).ToList();


            //Console.WriteLine("Lista {0}", listOfPlaces.Count());



            foreach (var v in listOfPlaces)
            {
                //Console.WriteLine("the partition key is {0}", v.newPartitionKey);


                foreach (string word in words)
                {

                    int wordAdded = 0;
                    int itemExist = 0;

                    string tem = (v.PartitionKey.ToString()).ToLower();




                    if (tem.Equals(keyword))
                    {
                        itemExist = 0;
                        // Console.WriteLine("The list contains {0} ",results.Count());

                        for (int i = 0; i < results.Count(); i++)
                        {
                            if (results[i].RowKey.Equals(v.RowKey))
                            {
                                //Console.WriteLine("The item already exists");
                                itemExist = 1;
                            }
                        }

                        if (itemExist == 0)
                        {
                            results.Add(new TableKeys() { PartitionKey = v.newPartitionKey, RowKey = v.RowKey, Counter = counterOfKeyword });
                            //Console.WriteLine("Insert of item");
                        }

                    }

                }

            }

        }
开发者ID:BL-publicdomain,项目名称:blpublicdomain,代码行数:64,代码来源:AzureStorageController.cs

示例7: queryForOCR1

        public void queryForOCR1(CloudTable placebl, ref List<TableKeys> results, string keyword)
        {
            char[] delimiters = new char[] { '\r', '\n', ' ', ',', '.', '<', '>', '?', '.', '!', '[', ']', '{', '}', '"' };


            //frequency of word in OCR
            int counterOCR = 0;




            TableQuery<BookEntity> queryPlaces =
       new TableQuery<BookEntity>()
          .Where(TableQuery.GenerateFilterCondition("PartitionKey",
              QueryComparisons.GreaterThanOrEqual, " ")).Take(10);

            var listOfPlaces = placebl.ExecuteQuery(queryPlaces).ToList();

            //Console.WriteLine("{0}",listOfPlaces.Count());


            string ocr = "";
            int itemExist = 0;

            foreach (var v in listOfPlaces)
            {


                ocr = v.ocrtext;
                //Console.WriteLine("{0}", ocr);
                itemExist = 0;


                if (ocr != "")
                {


                    //Console.WriteLine("Found");






                    frequentWordInOCR(ocr, keyword, out counterOCR);
                    if (counterOCR != 0)
                    {

                        for (int i = 0; i < results.Count(); i++)
                        {
                            //Console.Write("{0} ", results[i].RowKey);
                            //Console.WriteLine("{0} ", v.RowKey);

                            string finalPK = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, results[i].PartitionKey);
                            string finalRK = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, results[i].RowKey);

                            TableQuery<BookEntity> finalquery = new TableQuery<BookEntity>().Where(TableQuery.CombineFilters(finalPK, TableOperators.And, finalRK));

                            var finallist = placebl.ExecuteQuery(finalquery).ToList();

                            foreach (var vv in finallist)
                            {

                                bool resultEqual = vv.ocrtext.Equals(v.ocrtext);

                                if (resultEqual)
                                {

                                    //Console.WriteLine("The item already exists");
                                    itemExist = 1;
                                }

                            }

                        }

                    }


                    if (itemExist == 0 && counterOCR != 0)
                    {
                        results.Add(new TableKeys() { PartitionKey = v.PartitionKey, RowKey = v.RowKey, Counter = counterOCR });
                        //Console.WriteLine("Insert of item");
                    }

                }

            }

        }
开发者ID:BL-publicdomain,项目名称:blpublicdomain,代码行数:90,代码来源:AzureStorageController.cs

示例8: searchMainTable

        public void searchMainTable(CloudTable mainbl, ref List<TableKeys> results, string keyword)
        {


            int rank = 1;

            // string[] words = keyword.Split();


            char[] delimiters = new char[] { '\r', '\n', ' ', ',', '.', '<', '>', '?', '.', '!', '[', ']', '{', '}' };
            string[] words = keyword.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);



            int counterOfKeyword = words.Count();

            Console.WriteLine();

            for (int i = counterOfKeyword; i > 0; i--)
            {
                string finalPK = "";
                string finalRK = "";
                foreach (TableKeys entry in results)
                {


                    if (entry.Counter == i)
                    {


                        finalPK = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, entry.PartitionKey);
                        finalRK = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, entry.RowKey);

                        TableQuery<BookEntity> finalquery = new TableQuery<BookEntity>().Where(TableQuery.CombineFilters(finalPK, TableOperators.And, finalRK));

                        var finallist = mainbl.ExecuteQuery(finalquery).ToList();

                        //Console.WriteLine("The result in the main {0}", finallist.Count());

                        foreach (var vv in finallist)
                        {
                            Console.WriteLine("{0} {1}", rank, vv.title);
                            Console.WriteLine("by {0} ", vv.publisher);
                            Console.WriteLine(vv.place);
                            Console.WriteLine();
                            rank += 1;


                            //Console.WriteLine("The publisher is {0}", vv.publisher);
                        }

                    }

                }

            }


            Console.WriteLine("Total Results Found {0}", rank - 1);

        }
开发者ID:BL-publicdomain,项目名称:blpublicdomain,代码行数:61,代码来源:AzureStorageController.cs

示例9: __fetchScheduledItems

        private ScheduledTask[] __fetchScheduledItems(CloudTable scheduleTable, string channel, int retryCount)
        {
            /* ------------------------------------
            * Make Range Query to fetch tasks with scheduled time elapsed.
             * The reason we retrieve 50 items is that each row will be followed by two table operations each, which makes a total of 100 operations (Maximum handled by a BatchTableOperation)
            *-------------------------------------
            */

            const int count = 50;

            TableQuery<DynamicTableEntity> rangeQuery = new TableQuery<DynamicTableEntity>().Where(
                TableQuery.CombineFilters(
                    TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, channel),
                    TableOperators.And,
                    TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThan, DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmssffff"))))
                   .Take(count);

            var results = scheduleTable.ExecuteQuery(rangeQuery).Take(count).ToArray();

            if (results.Length == 0)
                return new ScheduledTask[0];

            /* ------------------------------------
             * For every ScheduleEntry retrieved, they must be deleted right away for concurency reason.
             * They are also 'postponed' at the specifyed time span in order to be fired again in case the task never completes.
             *-------------------------------------
             */

            TableBatchOperation tb = new TableBatchOperation();

            List<ScheduledTask> _items = new List<ScheduledTask>();

            foreach (var x in results)
            {
                int delimiter = x.RowKey.IndexOf('-');
                string[] rowSpl = new string[] { x.RowKey.Substring(0, delimiter), x.RowKey.Substring(delimiter + 1) };

                string tempPostponed = DateTime.Now.ToUniversalTime().AddSeconds(POSTPONE_DELAY_FOR_UNCOMMITED_SECONDS).ToString("yyyyMMddHHmmssffff") + "-" + rowSpl[1];

                DynamicTableEntity ghost = new DynamicTableEntity(x.PartitionKey, tempPostponed);
                ghost.Properties = x.Properties;

                int tryCount = 0;
                if (ghost.Properties.ContainsKey("RetryCount"))
                {
                    tryCount = ghost.Properties["RetryCount"].Int32Value.Value;
                }

                ghost.Properties["RetryCount"] = new EntityProperty(tryCount + 1);

                //delete an postpone
                tb.Add(TableOperation.Delete(x));
                tb.Add(TableOperation.Insert(ghost));

                _items.Add(new ScheduledTask
                {
                    ScheduledTime = DateTime.ParseExact(rowSpl[0], "yyyyMMddHHmmssffff", System.Globalization.CultureInfo.InvariantCulture),
                    Channel = channel,
                    FailedTimes = tryCount,
                    Data = x["Data"].StringValue,
                    Id = rowSpl[1]
                });

            }

            /* ----------------------------------------------------------------------------------------------------------------------------------------
            * Now that the batch operation containing deletes and 'postpones' is built, we execute it.
             *
             * This BatchOperation is the 'trick' that handles concurency, as the Azure Table Storage is centralized somewhere as one authority,
             * if two batches are made at the same time on the same rows, one of them will fail, hence it should'nt be possible to dequeue twice
            *------------------------------------------------------------------------------------------------------------------------------------------
            */
            TableResult[] tableResults = null;
            try
            {
                tableResults = scheduleTable.ExecuteBatch(tb).Where(x => x.HttpStatusCode == 201).ToArray(); //select only 201 response to get only inserted items results
                for (int i = 0; i < _items.Count; i++)
                {
                    _items[i].temporaryTask = (DynamicTableEntity)tableResults[i].Result;
                }
            }
            catch (Exception ex)
            {

             /* ----------------------------------------------------------------------------------------------------------------------------------------
             * If an exception occurs while executing, it's most likely because another Fetch operation where made at the same time (which should have succeed),
             * so we try to execute the FetchScheduledItems operation again to get the next items.
             *
             * If the exception keeps occuring after several retry times, it's most likely a problem with the Azure Storage Account.
            *------------------------------------------------------------------------------------------------------------------------------------------
                */
                if (retryCount >= 5)
                    throw ex;

                return __fetchScheduledItems(scheduleTable, channel, ++retryCount);
            }

            return _items.ToArray();
        }
开发者ID:raizam,项目名称:SimpleAzureScheduler,代码行数:99,代码来源:Scheduler.cs

示例10: queryForTitle1

        public void queryForTitle1(CloudTable placebl, ref List<TableKeys> results, string keyword)
        {
            char[] delimiters = new char[] { '\r', '\n', ' ', ',', '.', '<', '>', '?', '.', '!', '[', ']', '{', '}', '"' };


            ////split user-query into array
            //string[] words = keyword.Split();
            //int counterOfKeyword = words.Count();



            int counterOfKeyword = 0;
            //string[] words = keyword.Split();

            string[] words = keyword.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);


            TableQuery<PlaceEntity> queryPlaces =
       new TableQuery<PlaceEntity>()
          .Where(TableQuery.GenerateFilterCondition("PartitionKey",
              QueryComparisons.GreaterThanOrEqual, " "));

            var listOfPlaces = placebl.ExecuteQuery(queryPlaces).ToList();


            //Console.WriteLine("{0}",listOfPlaces.Count());


            //Console.WriteLine("Lista {0}", listOfPlaces.Count());


            int counter = 0;



            foreach (var v in listOfPlaces)
            {
                //counter++;
                //Console.Write("{0}  ", counter);

                int itemExist = 0;
                counterOfKeyword = 0;


                foreach (string word in words)
                {

                    //Console.WriteLine("We examine the word {0}", word);


                    int wordAdded = 0;


                    //Console.WriteLine(text);
                    //char[] delimiters = new char[] { '\r', '\n', ' ', ',', '.', '<', '>', '?', '.', '!', '[', ']', '{', '}' , '"'};
                    //string[] words = line.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);



                    string temp = (v.PartitionKey.ToString()).ToLower();
                    string[] temporarylist = temp.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

                    foreach (string tem in temporarylist)
                    {
                        //Console.Write("the partition key is {0}",tem);

                        if (tem.Equals(word))
                        {



                            counterOfKeyword++;
                            // itemExist = 0;
                            // Console.WriteLine("The list contains {0} ",results.Count());

                            for (int i = 0; i < results.Count(); i++)
                            {
                                if (results[i].RowKey.Equals(v.RowKey))
                                {
                                    //Console.WriteLine("The item already exists");
                                    itemExist = 1;
                                }
                            }
                        }

                    }

                }



                if (itemExist == 0)
                {
                    results.Add(new TableKeys() { PartitionKey = v.newPartitionKey, RowKey = v.RowKey, Counter = counterOfKeyword });
                    //Console.WriteLine("Insert of item");
                }

            }

        }
开发者ID:BL-publicdomain,项目名称:blpublicdomain,代码行数:100,代码来源:AzureStorageController.cs

示例11: Data

    public ActionResult Data(string ModuleName, int takenum, string DateStart, string DateEnd) {

      table = common.AzureAccess();
      Malldata AllData = new Malldata();

      var loginuser = RDB.db.Users.Where(p => p.idName.Equals(User.Identity.Name)).Single();
      var module = loginuser.Modules.Where(p => p.Name.Equals(ModuleName)).Single();
      int id = module.id;
      var units = module.Units;

      // 削除中ならmoduleテーブルのTypeプロパティは"1"である(DataDeleteController参照)
      if (module.Type.Equals("1")) {
        AllData.ModuleName = ModuleName;
        AllData.Deleting = true;
        return View(AllData);
      } else {
        AllData.Deleting = false;
      }

      // データ数が0なら
      if (module.NumData == 0) {
        AllData.ModuleName = ModuleName;
        AllData.NumData = 0;
        return View(AllData);
      }

      // AllDataの中には、takenum件から20件のValueデータが入る
      TableQuery<DataEntity> query = GetQueryTakeNum(id, takenum, DateStart, DateEnd);
      AllData = GetData(query, units);

      //takenum件から20件のTakeデータを取得して、DataValプロパティが"BlobData"ならば、そのデータはBlobデータである。
      TableQuery<DataEntity> query1 = new TableQuery<DataEntity>().Where(
          TableQuery.CombineFilters(
          TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Take," + id),
          TableOperators.And,
          TableQuery.CombineFilters(
          TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, common.GetTimeIndex(DateStart)),
          TableOperators.And,
          TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, common.GetTimeIndex(DateEnd))
          )
        )).Take(takenum);
      TableQuery<DataEntity> query2 = new TableQuery<DataEntity>().Where(
        TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Take," + id),
        TableOperators.And,
        TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, table.ExecuteQuery(query1).LastOrDefault().RowKey)
      )).Take(20);
      AllData.FlagBlob = new List<bool>();
      foreach (var entity in table.ExecuteQuery(query2)) {
        if (entity.DataVal == null) {
          AllData.FlagBlob.Add(false);
        } else {
          if (entity.DataVal.Equals("BlobData")) {
            AllData.FlagBlob.Add(true);
          } else {
            AllData.FlagBlob.Add(false);
          }
        }
      }

      AllData.ModuleName = ModuleName;
      AllData.NumData = GetDataCount(id, DateStart, DateEnd);
      AllData.TakeNum = takenum;
      AllData.Id = id;
      AllData.DateStart = DateStart;
      AllData.DateEnd = DateEnd;



      return View(AllData);
    }
开发者ID:kazuki-mo,项目名称:SmartHome-Cats,代码行数:71,代码来源:HomeController.cs

示例12: ExecuteQueryAndAssertResults

 private static void ExecuteQueryAndAssertResults(CloudTable table, string filter, int expectedResults)
 {
     Assert.AreEqual(expectedResults, table.ExecuteQuery(new TableQuery<ComplexEntity>().Where(filter)).Count());
 }
开发者ID:Gajendra-Bahakar,项目名称:azure-storage-net,代码行数:4,代码来源:TableQueryGenericTests.cs

示例13: Post

    // Azure Tableのデータを取得
    // POST api/data/{UserID名}/{Module名}
    public alldata Post(string fir, string sec, [FromBody]DataQuery dataquery) {

      alldata AllData = new alldata();  // 取得したデータをここに格納

      // RDBの中から、ターゲットモジュールなどを検索
      try {
          var usertest = RDB.db.Users.Where(p => p.idName.Equals(fir)).Single();
      } catch {
          AllData.Type = new List<string>();
          AllData.Type.Add("User does not exist.");
          return AllData;
      }
      var user = RDB.db.Users.Where(p => p.idName.Equals(fir)).Single();
      try {
          var moduletest = user.Modules.Where(p => p.Name.Equals(sec)).Single();
      } catch {
          AllData.Type = new List<string>();
          AllData.Type.Add("Module does not exist.");
          return AllData;
      }
      var module = user.Modules.Where(p => p.Name.Equals(sec)).Single();
      var units = module.Units;

      // パスワードチェック
      if (common.PasswordError(dataquery.pw, module.rPassWord)) {
        AllData.Type = new List<string>();
        AllData.Type.Add("Password Error");
        return AllData;
      }

      table = common.AzureAccess(); // Azure Tableへアクセス

      TableQuery<DataEntity> query = new TableQuery<DataEntity>();

      if ((dataquery.since == null) && (dataquery.until == null)) { //範囲指定なし
        query = new TableQuery<DataEntity>().Where(
        TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Value," + module.id),
        TableOperators.And,
        TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, common.GetTimeIndex(module.Latest))
        ));
      } else if (dataquery.since == null) { //~untilのデータ取得
        query = new TableQuery<DataEntity>().Where(
        TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Value," + module.id),
        TableOperators.And,
        TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, common.GetTimeIndex(dataquery.until))
      ));
      } else if (dataquery.until == null) { //since~のデータ取得
        query = new TableQuery<DataEntity>().Where(
        TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Value," + module.id),
        TableOperators.And,
        TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, common.GetTimeIndex(dataquery.since) + 1)
      ));
      } else { //since~untilのデータ取得
        query = new TableQuery<DataEntity>().Where(
        TableQuery.CombineFilters(
        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Value," + module.id),
        TableOperators.And,
        TableQuery.CombineFilters(
          TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, common.GetTimeIndex(dataquery.since) + 1),
          TableOperators.And,
          TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, common.GetTimeIndex(dataquery.until))
          )
      ));
      }

      List<DataEntity> BeforeDataList = new List<DataEntity>();
      List<DataEntity> AfterDataList = new List<DataEntity>();

      BeforeDataList = table.ExecuteQuery(query).ToList<DataEntity>();
      AfterDataList = table.ExecuteQuery(query).ToList<DataEntity>();

      //"asc"なら逆順にする
      if (dataquery.orderby.Equals("asc")) {
        int count = BeforeDataList.Count();
        int i = 1;
        foreach (var BeforeData in BeforeDataList) {
          AfterDataList[count - i] = BeforeData;
          i++;
        }
      }

      string[] Type;
      int[] TypeId;

      int num = 0;

      //unitlistの中には、ユーザが取得したいデータの列インデックスが格納されている
      if (dataquery.unitlist == null) {
        Type = new string[units.Count];
        TypeId = new int[units.Count];
        foreach (var unit in units) {
          Type[num] = unit.Unit1;
          TypeId[num] = unit.id;
          num++;
        }
//.........这里部分代码省略.........
开发者ID:kazuki-mo,项目名称:SmartHome-Cats,代码行数:101,代码来源:dataController.cs

示例14: AssignOwner

 // Private methods
 private People AssignOwner(Question q, CloudTable table)
 {
     // Grab a random person from the list of people who match that category.
     TableQuery<People> query = new TableQuery<People>();
     var results = table
         .ExecuteQuery(query);
     if (results.Count() <= 0)
     {
         return null;
     }
     return results.ElementAt((new Random()).Next(0, results.Count()));
 }
开发者ID:christopheranderson,项目名称:feedbackengine,代码行数:13,代码来源:Questions.cs

示例15: ExecuteSimpleQuery

        /// <summary>
        /// Demonstrate a partition range query that searches within a partition for a set of entities that are within a 
        /// specific range. This query returns all entities in the range. Note that if your table contains a large amount of data,
        /// the query may be slow or may time out. In that case, use a segmented query, as shown in the PartitionRangeQueryAsync() 
        /// sample method.
        /// Note that the ExecuteSimpleQuery method is called synchronously, for the purposes of the sample. However, in a real-world
        /// application using the async/await pattern, best practices recommend using asynchronous methods consistently.
        /// </summary>
        /// <param name="table">Sample table name</param>
        /// <param name="partitionKey">The partition within which to search</param>
        /// <param name="startRowKey">The lowest bound of the row key range within which to search</param>
        /// <param name="endRowKey">The highest bound of the row key range within which to search</param>
        private static void ExecuteSimpleQuery(CloudTable table, string partitionKey, string startRowKey, string endRowKey)
        {
            try
            {
                // Create the range query using the fluid API 
                TableQuery<CustomerEntity> rangeQuery = new TableQuery<CustomerEntity>().Where(
                    TableQuery.CombineFilters(
                            TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey),
                            TableOperators.And,
                            TableQuery.CombineFilters(
                                TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, startRowKey),
                                TableOperators.And,
                                TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThanOrEqual, endRowKey))));

                foreach (CustomerEntity entity in table.ExecuteQuery(rangeQuery))
                {
                    Console.WriteLine("Customer: {0},{1}\t{2}\t{3}", entity.PartitionKey, entity.RowKey, entity.Email, entity.PhoneNumber);
                }
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
开发者ID:Azure-Samples,项目名称:storage-table-dotnet-getting-started,代码行数:38,代码来源:AdvancedSamples.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.CloudTable.ExecuteQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。