private static Dictionary <ChangeKey, List <Change> > ToDictionary(ChangeSet changeSet)
        {
            var result = new Dictionary <ChangeKey, List <Change> >();

            foreach (var change in changeSet.MemberChanges)
            {
                var key = new ChangeKey(change.Namespace, change.Name);

                List <Change> ignoredChanges;
                if (result.TryGetValue(key, out ignoredChanges))
                {
                    if (ignoredChanges.Any(e => e == change))
                    {
                        throw new InvalidOperationException($"The ignore change set contains the duplicate entry '{key}'.");
                    }

                    ignoredChanges.Add(change);
                    continue;
                }

                result.Add(key, new List <Change> (1)
                {
                    change
                });
            }

            return(result);
        }
Пример #2
0
        private static Dictionary <ChangeKey, Change> ToDictionary(ChangeSet changeSet)
        {
            //return changeSet.MemberChanges.ToDictionary (e => new ChangeKey (e.Namespace, e.Name), e => e);


            ChangeKey key = default(ChangeKey);

            try
            {
                var result = new Dictionary <ChangeKey, Change>();
                foreach (var change in changeSet.MemberChanges)
                {
                    key = new ChangeKey(change.Namespace, change.Name);
                    result.Add(key, change);
                }

                return(result);
            }
            catch (ArgumentException ex)
            {
                throw new InvalidOperationException($"Change set contains duplicate entry: '{key}'.", ex);
            }
        }
Пример #3
0
 public bool Equals(ChangeKey other)
 {
     return(string.Equals(Namespace, other.Namespace) && string.Equals(Name, other.Name));
 }