public void Build(DbCommandBuilder builder, IServiceProvider serviceProvider) { if (ConflictTarget != null && ConflictAction != null) { builder.SqlBuilder.Write("on conflict "); var aliasOption = serviceProvider.GetRequiredService <AliasOption>(); var aliasOptionClone = aliasOption.Clone(); aliasOption.EmitTable = false; ConflictTarget.Build(builder, serviceProvider); aliasOption.Restore(aliasOptionClone); builder.SqlBuilder.WriteLine(); ++builder.SqlBuilder.Indent; builder.SqlBuilder.Write("do "); ConflictAction.Build(builder, serviceProvider); if (WhereClause != null) { builder.SqlBuilder.WriteLine("where"); ++builder.SqlBuilder.Indent; WhereClause.Build(builder, serviceProvider); --builder.SqlBuilder.Indent; } --builder.SqlBuilder.Indent; } }
/// <summary> /// A conflict has occured, we try to ask for the solution to the user /// </summary> internal (ApplyAction, DmRow) GetConflictAction(SyncConflict conflict, ConflictResolutionPolicy policy, DbConnection connection, DbTransaction transaction = null) { ConflictAction conflictAction = ConflictAction.ServerWins; if (policy == ConflictResolutionPolicy.ClientWins) { conflictAction = ConflictAction.ClientWins; } var arg = new ApplyChangeFailedEventArgs(conflict, conflictAction, connection, transaction); this.ApplyChangedFailed?.Invoke(this, arg); // if ConflictAction is ServerWins or MergeRow it's Ok to set to Continue ApplyAction action = ApplyAction.Continue; if (arg.Action == ConflictAction.ClientWins) { action = ApplyAction.RetryWithForceWrite; } DmRow finalRow = arg.Action == ConflictAction.MergeRow ? arg.FinalRow : null; // returning the action to take, and actually the finalRow if action is set to Merge return(action, finalRow); }
public MemberIntroduction(MemberInfo memberInfo, ConflictAction conflictAction, Aspect aspect) : base(aspect) { ArgumentUtility.CheckNotNull("memberInfo", memberInfo); ArgumentUtility.CheckNotNull("aspect", aspect); _memberInfo = memberInfo; _conflictAction = conflictAction; }
public ApplyChangeFailedEventArgs(SyncConflict dbSyncConflict, ConflictAction action, DbConnection connection, DbTransaction transaction) { this.syncConflict = dbSyncConflict; this.connection = connection; this.transaction = transaction; this.applyAction = action; this.finalRowTable = dbSyncConflict.RemoteRow.Table.Clone(); this.finalRowTable.TableName = dbSyncConflict.RemoteRow.Table.TableName; }
public FrmConflictResolution(String _message) { InitializeComponent(); toLocal = kwm.KwmAppControls.Properties.Resources.tolocal; toLocalGrey = kwm.KwmAppControls.Properties.Resources.tolocal_grey; toServer = kwm.KwmAppControls.Properties.Resources.toserver; toServerGrey = kwm.KwmAppControls.Properties.Resources.toserver_grey; picToLocal.Image = toLocalGrey; picToServer.Image = toServerGrey; m_action = ConflictAction.Cancel; label1.Text = _message; }
private void UpdateUIStatus() { if (radioToServer.Checked) { picToServer.Image = toServer; picToLocal.Image = toLocalGrey; } else if(radioToLocal.Checked) { picToServer.Image = toServerGrey; picToLocal.Image = toLocal; } btnOK.Enabled = (radioToServer.Checked || radioToLocal.Checked); if (radioToLocal.Checked) m_action = ConflictAction.Download; else if (radioToServer.Checked) m_action = ConflictAction.Upload; else /* Should not happen if radio buttons behave */ m_action = ConflictAction.Cancel; }
public IntroduceMemberAttribute(ConflictAction conflictAction) { _conflictAction = conflictAction; }