Beispiel #1
0
        private DictionaryAccessor(Dictionary <string, object> instance, Dictionary <string, CompiledIndexField> groupByFields = null)
        {
            if (instance == null)
            {
                throw new NotSupportedException("Indexed dictionary must be of type: Dictionary<string, object>");
            }

            foreach (var key in instance.Keys)
            {
                var getMethod = new DictionaryValueAccessor(key);

                if (groupByFields != null)
                {
                    foreach (var groupByField in groupByFields.Values)
                    {
                        if (groupByField.IsMatch(key))
                        {
                            getMethod.GroupByField   = groupByField;
                            getMethod.IsGroupByField = true;
                            break;
                        }
                    }
                }

                _properties.Add(key, getMethod);
                _propertiesInOrder.Add(new KeyValuePair <string, DictionaryValueAccessor>(key, getMethod));
            }
        }
Beispiel #2
0
        private DictionaryAccessor(Dictionary <string, object> instance, HashSet <string> groupByFields = null)
        {
            if (instance == null)
            {
                throw new NotSupportedException("Indexed dictionary must be of type: Dictionary<string, object>");
            }

            foreach (var key in instance.Keys)
            {
                var getMethod = new DictionaryValueAccessor(key);

                if (groupByFields != null && groupByFields.Contains(key))
                {
                    getMethod.IsGroupByField = true;
                }

                _properties.Add(key, getMethod);
                _propertiesInOrder.Add(new KeyValuePair <string, DictionaryValueAccessor>(key, getMethod));
            }
        }