private void SynchronizeRepositories() { // if one persists, but not the other, then the persistable one wins // otherwise, go with the repository most recently changed IDataMapper <T> master = _secondary; IDataMapper <T> slave = _primary; if ((_primary.CanPersist && !_secondary.CanPersist) || (_primary.LastModified > _secondary.LastModified && _primary.CanPersist == _secondary.CanPersist)) { master = _primary; slave = _secondary; } RepositoryId[] ids = master.GetAllItems(); // avoid doing anything which would change LastModifiedTime if both are empty if (ids.Length == 0 && slave.CountAllItems() == 0) { return; } slave.DeleteAllItems(); foreach (RepositoryId id in ids) { T slaveItem = slave.CreateItem(); _copyStrategy(slaveItem, master.GetItem(id)); } }
public void DeleteAllItems() { _decoratedDataMapper.DeleteAllItems(); _caches.DeleteAllItemsFromCaches(); }
public void DeleteAllItems() { _primary.DeleteAllItems(); _secondary.DeleteAllItems(); }