Hi Christian
Where you validation process automagically generates code with multiple checks on a single field, would it be possible to conflate them thereby reducing code and making it slightly faster. E.g.:
if (!ARow.IsRecipientLedgerNumberNull())
{
// 'RecipientLedgerNumber' must have a value (NOT NULL constraint)
ValidationColumn = ARow.Table.Columns[AGiftDetailTable.ColumnRecipientLedgerNumberId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TGeneralChecks.ValueMustNotBeNull(ARow.IsRecipientLedgerNumberNull() ? null : "",
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
if (!ARow.IsRecipientLedgerNumberNull())
{
// 'RecipientLedgerNumber' must not have more than 10 digits and no decimals
ValidationColumn = ARow.Table.Columns[AGiftDetailTable.ColumnRecipientLedgerNumberId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
VerificationResult = TNumericalChecks.IsNumberPrecisionNotExceeded(ARow.RecipientLedgerNumber, 10, 0,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
That could become:
if (!ARow.IsRecipientLedgerNumberNull())
{
ValidationColumn = ARow.Table.Columns[AGiftDetailTable.ColumnRecipientLedgerNumberId];
if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
{
// RecipientLedgerNumber' must have a value (NOT NULL constraint)
VerificationResult = TNumericalChecks.IsNumberPrecisionNotExceeded(ARow.RecipientLedgerNumber, 10, 0,
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
// 'RecipientLedgerNumber' must not have more than 10 digits and no decimals
VerificationResult = TGeneralChecks.ValueMustNotBeNull(ARow.IsRecipientLedgerNumberNull() ? null : "",
ValidationControlsData.ValidationControlLabel,
AContext, ValidationColumn, ValidationControlsData.ValidationControl);
// Handle addition to/removal from TVerificationResultCollection
AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
}
}
Is it possible/easy to do?
Thanks
Chris