private void PopulateUpdate(ISyncableEntity entity) { var query = new UpdateSyncQuery(_datastore, entity, _syncSession); Update = _datastore.ExecuteQuery(query, _entitySerialiazer) .Where(IsNotInserted) .ToList(); }
public UpdateSyncQuery(IDataStore datastore, ISyncableEntity entity, ISyncSessionInfo syncSession) : base(datastore, entity, syncSession) { }
protected SyncQuery(IDataStore datastore, ISyncableEntity entity, ISyncSessionInfo syncSession) { _datastore = datastore; _syncSession = syncSession; Entity = entity; }
private void PopulateInsert(ISyncableEntity entity) { var query = new InsertSyncQuery(_datastore, entity, _syncSession); Insert = _datastore.ExecuteQuery(query, _entitySerialiazer).ToList(); }
private bool HasChangedOnBothSide(EntityChange existing, ISyncableEntity entity) { return(existing.HasChangedInSession(entity.UpdateTrackingColumn, _syncSession) || existing.HasChangedInSession(entity.LastSyncTrackingColumn, _syncSession)); }
private bool HasInsertedOnTarget(EntityChange existing, ISyncableEntity entity) { return(existing.HasChangedInSession(entity.CreationTrackingColumn, _syncSession)); }
private void ApplyDeletetWhenExistInLocal(IEntityConflict entityConflict, EntityChange existing, ISyncableEntity entity, EntityChange row) { if (HasInsertedOnTarget(existing, entity)) { entityConflict.OnApplyDeleteExistingInserted(existing); return; } if (HasChangedOnBothSide(existing, entity)) { entityConflict.OnApplyDeleteExistingUpdated(existing); return; } try { row.ApplyDelete(_datastore, EntityName, _entitySerialiazer); } catch { entityConflict.OnApplyDelete(existing, row); } }
private void ApplyUpdateWhenExistInLocal(IEntityConflict entityConflict, EntityChange existing, ISyncableEntity entity, EntityChange row) { if (HasChangedOnBothSide(existing, entity)) { entityConflict.OnApplyUpdateExistingUpdatedToo(existing, row); return; } try { row.ApplyUpdate(_datastore, _entitySerialiazer); } catch { entityConflict.OnApplyUpdate(existing, row); } }
private void PopulateDelete(ISyncableEntity entity) { var query = new DeleteSyncQuery(_datastore, entity, _syncSession); Delete = _datastore.ExecuteQuery(query, _entityTombstoneSerialiazer).ToList(); }
public DeleteSyncQuery(IDataStore datastore, ISyncableEntity entity, ISyncSessionInfo syncSession) : base(datastore, entity.EntityTombstoneInfo, syncSession) { }