public IDictionary <KEY, List <INSTANCE> > GetByDistinctKeys(IEnumerable <INSTANCE> instances) { Dictionary <KEY, List <INSTANCE> > dictionary = new Dictionary <KEY, List <INSTANCE> >(); foreach (INSTANCE instance in instances) { KEY key = getKey.Invoke(instance); List <INSTANCE> instancesForKey; if (!dictionary.TryGetValue(key, out instancesForKey)) { instancesForKey = new List <INSTANCE>(); dictionary[key] = instancesForKey; } instancesForKey.Add(instance); } return(dictionary); }
public override System.Data.EntityKey GetTargetEntityKey(string currentKey) { return(_getTargetKey.Invoke(currentKey)); }