public void ValidateFields(ValidationContext context)
{
var timer = nHydrate.Dsl.Custom.DebugHelper.StartTimer();
try
{
if (!this.IsGenerated) return;
var columnList = this.GetFields().Where(x => x.IsGenerated).ToList();
if (columnList.Count == 0)
context.LogError(string.Format(ValidationHelper.ErrorTextTableComponentNoColumns, this.Name), string.Empty, this);
#region Check for duplicate names
var nameList = new HashSet<string>();
foreach (var column in columnList)
{
var name = column.PascalName.ToLower();
if (nameList.Contains(name))
context.LogError(string.Format(ValidationHelper.ErrorTextDuplicateName, column.Name), string.Empty, this);
else
nameList.Add(name);
}
#endregion
}
catch (Exception ex)
{
throw;
}
finally
{
nHydrate.Dsl.Custom.DebugHelper.StopTimer(timer, "Composite Validate - Fields");
}
}