private void DiffAndUpdateFolder(IEnumerable <IStorePropertyBag> sourceContacts, IEnumerable <IStorePropertyBag> targetContacts) { ArgumentValidator.ThrowIfNull("sourceContacts", sourceContacts); ArgumentValidator.ThrowIfNull("targetContacts", targetContacts); ListDiffCalculator <IStorePropertyBag, PropertyDefinition> listDiffCalculator = new ListDiffCalculator <IStorePropertyBag, PropertyDefinition>(StoreContactPersonIdComparer.Instance, new ContactDeltaCalculator(GALContactsFolderSchema.ContactPropertyDefinitions)); DiffResult <IStorePropertyBag, PropertyDefinition> diffResult = listDiffCalculator.DiffUnSortedLists(sourceContacts.ToList <IStorePropertyBag>(), targetContacts.ToList <IStorePropertyBag>()); this.AddContacts(diffResult.AddList); this.UpdateContacts(diffResult.UpdateList); }
private void PopulatePersonInfo(IEnumerable <IStorePropertyBag> collectionToLoadInformation, IEnumerable <IStorePropertyBag> collectionWithInformation) { ListDiffCalculator <IStorePropertyBag, PropertyDefinition> listDiffCalculator = new ListDiffCalculator <IStorePropertyBag, PropertyDefinition>(StoreContactEmailAddressComparer.Instance, new ContactDeltaCalculator(RefreshGalFolder.RecipientCacheSpecificProperties)); DiffResult <IStorePropertyBag, PropertyDefinition> diffResult = listDiffCalculator.DiffUnSortedLists(collectionToLoadInformation.ToList <IStorePropertyBag>(), collectionWithInformation.ToList <IStorePropertyBag>()); if (diffResult.UpdateList.Count == 0) { return; } foreach (IStorePropertyBag storePropertyBag in diffResult.UpdateList.Keys) { foreach (Tuple <PropertyDefinition, object> tuple in diffResult.UpdateList[storePropertyBag]) { storePropertyBag[tuple.Item1] = tuple.Item2; } } }