public void SetDatastore(ISqlDataStore value) { _datastore = value; var entityInfo = GetSyncableEntity(); _entitySerialiazer = new EntityChangesetBuilder(entityInfo, _syncSession); if (entityInfo.IsDeleteTrackEnable) { _entityTombstoneSerialiazer = new EntityChangesetBuilder(entityInfo.EntityTombstoneInfo, _syncSession); } }
public void ApplyDelete(ISqlDataStore datastore, string entityName, EntityChangesetBuilder entitySerialiazer) { try { using (var command = entitySerialiazer.ToDelete(datastore, entityName, this)) { datastore.ExecuteNonQuery(command); } } catch (Exception e) { throw new Exception(string.Format("Erreur lors de la suppression {0}. Exception: {1}", this, e)); } }
public void ApplyInsert(ISqlDataStore datastore, EntityChangesetBuilder entitySerialiazer) { try { DisableAutoIncrement(datastore); using (var command = entitySerialiazer.ToInsert(datastore, EntityName, this)) { datastore.ExecuteNonQuery(command); } } catch (Exception e) { throw new Exception(string.Format("Erreur lors de l'insertion {0}. Exception: {1}", this, e)); } finally { RestoreAutoIncrement(datastore); } }