QueryAllEntitiesAsListDict() public method

public QueryAllEntitiesAsListDict ( string table, string query, int max ) : TableStorageListDictResponse
table string
query string
max int
return TableStorageListDictResponse
Beispiel #1
0
        public void QueryAllEntitiesAsDictsIsSuccessful()
        {
            if (ts.ExistsEntity(test_table, test_query) == false)
            {
                CreateEntityIsSuccessful();
            }
            var ts_response = ts.QueryAllEntitiesAsListDict(test_table, test_query, 0);
            var dicts       = ts_response.list_dict_obj;

            AssertEntity(dicts);
        }
Beispiel #2
0
        public static List <Dictionary <string, object> > FetchPurgeableCacheDicts()
        {
            var query = String.Format("$filter=(PartitionKey eq '{0}')", cache_control_tablename);
            var marked_cache_url_dicts = ts.QueryAllEntitiesAsListDict(cache_control_tablename, query, 0).list_dict_obj;
            var purgeable_cache_dicts  = marked_cache_url_dicts.FindAll(dict => (int)dict["count"] > 0);

            return(purgeable_cache_dicts);
        }
Beispiel #3
0
        // the prioritylogtriggers table has rules for things in a Counters
        private static List <Dictionary <string, string> > GetPriorityLogTriggers(TableStorage ts)
        {
            var query         = "$filter=(PartitionKey eq 'prioritylogtriggers')";
            var ts_response   = ts.QueryAllEntitiesAsListDict("prioritylogtriggers", query, 0);
            var list_dict_obj = ts_response.list_dict_obj;
            var list_dict_str = new List <Dictionary <string, string> >();

            foreach (var dict_obj in list_dict_obj)
            {
                list_dict_str.Add(ObjectUtils.DictObjToDictStr(dict_obj));
            }
            return(list_dict_str);
        }
Beispiel #4
0
        public bool IsTrustedId(string foreign_id)
        {
            var q = String.Format("$filter=PartitionKey eq '{0}' and {1} eq '{2}'", this.trusted_table, this.trusted_field, foreign_id);

            return(ts.QueryAllEntitiesAsListDict(this.trusted_table.ToString(), q, 0).list_dict_obj.Count > 0);            // foreign id to elmcity id is many to one
        }
Beispiel #5
0
 // the prioritylogtriggers table has rules for things in a Counters
 private static List<Dictionary<string, string>> GetPriorityLogTriggers(TableStorage ts)
 {
     var query = "$filter=(PartitionKey eq 'prioritylogtriggers')";
     var ts_response = ts.QueryAllEntitiesAsListDict("prioritylogtriggers", query);
     var list_dict_obj = ts_response.list_dict_obj;
     var list_dict_str = new List<Dictionary<string, string>>();
     foreach (var dict_obj in list_dict_obj)
         list_dict_str.Add(ObjectUtils.DictObjToDictStr(dict_obj));
     return list_dict_str;
 }
Beispiel #6
0
        private static CounterResponse _GetCounters()
        {
            /* the counters we want to store and read are named in an azure table, sample record like so:
             *
             *        Table: counters
             * PartionKey: counters
             *       RowKey: proc_total_time
             * Category: Processor
             * Description: % Processor Time
             * Qualifier: _Total
             *
             * return an object with two dicts
             *
             * 1. of path-like strings used to specify counters to Azure diagnostics)
             *
             * key: processor_pct_proc_time
             * val: /Processor(_Total)/% Processor time
             *
             * 2. of actual counters used for live snapshot
             *
             * key: processor_pct_proc_time
             * val: new PerformanceCounter("Processor", "% Processor Time", "_Total")
             */

            var counter_paths   = new Dictionary <string, string>();
            var counter_objects = new Dictionary <string, PerformanceCounter>();

            var query       = "$filter=(PartitionKey eq 'counters')";
            var ts_response = ts.QueryAllEntitiesAsListDict("counters", query, 0);
            var counter_names_and_categories = ts_response.list_dict_obj;

            foreach (var counter_name_and_category in counter_names_and_categories)
            {
                var c = ObjectUtils.DictObjToDictStr(counter_name_and_category);

                if (c.ContainsKey("active") && c["active"] == "no")                 // skip if marked inactive
                {
                    continue;
                }

                var category = c["category"];

                //http://support.microsoft.com/?kbid=2022138 -> solved in v4?

                //if (category == "ASP.NET")
                //	category = "ASP.NET v2.0.50727";

                //if (category == "ASP.NET Applications")
                //	category = "ASP.NET Apps v2.0.50727";

                var qualifier   = (c.ContainsKey("qualifier") ? c["qualifier"] : null);
                var description = c["description"];

                try
                {
                    if (qualifier != null)
                    {
                        counter_paths.Add(c["RowKey"], String.Format(@"\{0}({1})\{2}", category, qualifier, description));
                        counter_objects.Add(c["RowKey"], new PerformanceCounter(categoryName: category, counterName: description, instanceName: qualifier));
                    }
                    else
                    {
                        counter_paths.Add(c["RowKey"], String.Format(@"\{0}\{1}", category, description));
                        counter_objects.Add(c["RowKey"], new PerformanceCounter(categoryName: category, counterName: description));
                    }
                }
                catch (Exception e)
                {
                    GenUtils.PriorityLogMsg("exception", "GetCounters", category + "/" + description + " -> " + e.Message + e.StackTrace);
                }
            }
            return(new CounterResponse(counter_paths: counter_paths, counter_objects: counter_objects));
        }