Exemplo n.º 1
0
        public object PackCompoundKey(string kind, IEnumerable <object> components)
        {
            var result = new CompoundKey();

            foreach (var tuple in Enumerable.Zip(GetKeyNames(kind), components, Tuple.Create))
            {
                result[tuple.Item1] = tuple.Item2;
            }

            return(result);
        }
Exemplo n.º 2
0
        public object GetKey(string kind, IDictionary <string, object> data)
        {
            var keyNames = GetKeyNames(kind);

            if (keyNames.Count > 1)
            {
                var key = new CompoundKey();
                foreach (var name in keyNames)
                {
                    key[name] = data.GetSafe(name);
                }
                return(key);
            }

            return(data.GetSafe(keyNames.First()));
        }