private void ValidateColumns()
{
var duplicatedColumn = this.columns
.GroupBy(c => c.ColumnName)
.Select(x => new
{
Key = x.Key,
Count = x.Count()
})
.FirstOrDefault(x => x.Count > 1);
if (duplicatedColumn != null)
{
throw new MappingException(ExceptionMessages.TableInfo_ColumnMappedMultipleTimes.FormatWith(duplicatedColumn.Key));
}
if (this.columns.Count(c => c.IsIdentifier) > 1)
{
throw new MappingException(ExceptionMessages.TableInfo_MultipleIdentifierColumns.FormatWith(this.schema, this.name));
}
if (this.identifierStrategy == Mapping.IdentifierStrategy.Sequence
&& this.identifierColumn != null
&& string.IsNullOrEmpty(this.identifierColumn.SequenceName))
{
throw new MappingException(ExceptionMessages.TableInfo_SequenceNameNotSet.FormatWith(this.identifierColumn.ColumnName));
}
}