public void ProcessedEntity(IsolatedStorageOfflineEntity entity) { string atomId = entity.ServiceMetadata.Id; OfflineEntityKey key = entity.GetIdentity() as OfflineEntityKey; key.TypeName = entity.GetType().FullName; if (entity.IsTombstone) { if (String.IsNullOrEmpty(atomId)) { _pkeySet.Add(key); } else { _atomIdSet.Add(atomId); } } else { _pkeySet.Add(key); if (!String.IsNullOrEmpty(atomId)) { _atomIdSet.Add(atomId); } } }
public bool ContainsEntity(IsolatedStorageOfflineEntity entity) { // If the entity is a tombstone, use the atom id if (entity.IsTombstone) { if (String.IsNullOrEmpty(entity.ServiceMetadata.Id)) { // if it's a tombstone and the id is null, it means it is a delete of // a local insert that can be skipped, so we report it as already written return(true); } else { return(_atomIdSet.Contains(entity.ServiceMetadata.Id)); } } else { if (!String.IsNullOrEmpty(entity.ServiceMetadata.Id)) { return(_atomIdSet.Contains(entity.ServiceMetadata.Id)); } OfflineEntityKey key = entity.GetIdentity() as OfflineEntityKey; key.TypeName = entity.GetType().FullName; if (_pkeySet.Contains(key)) { return(true); } return(false); } }