public LookupViolationInformation Register(NBiRs.KeyCollection key, LookupMatchesViolationComposite composite) { if (ContainsKey(key)) { var info = this[key] as LookupMatchesViolationInformation; if (info.State != RowViolationState.Mismatch) { throw new ArgumentException("Can't change the state of lookup violation"); } info.CandidateRows.Add(composite); return(info); } else { var info = new LookupMatchesViolationInformation(RowViolationState.Mismatch); info.CandidateRows.Add(composite); Add(key, info); return(info); } }
public LookupViolationInformation Register(NBiRs.KeyCollection key, DataRow candidateRow) => Register(RowViolationState.Unexpected, key, candidateRow);
protected virtual LookupViolationInformation Register(RowViolationState state, NBiRs.KeyCollection key, DataRow candidateRow) { if (ContainsKey(key)) { var info = this[key]; if (info.State != state) { throw new ArgumentException("Can't change the state of lookup violation", nameof(state)); } info.AddCandidateRow(candidateRow); return(info); } else { LookupViolationInformation info = state == RowViolationState.Mismatch ? (LookupViolationInformation) new LookupMatchesViolationInformation(state) : new LookupExistsViolationInformation(state); info.AddCandidateRow(candidateRow); Add(key, info); return(info); } }