private List<ColumnInfo> CreateColumnInfos(Type forType, IdentifierStrategy identifierStrategy)
{
var properties = forType.GetProperties(BindingFlags.Instance | BindingFlags.Public);
var columns = new List<ColumnInfo>(properties.Length);
foreach (var property in properties.OrderBy(p => p.Name))
{
if (!property.CanRead || !property.CanWrite)
{
if (this.log.IsDebug)
{
this.log.Debug(LogMessages.MappingConvention_PropertyNotGetAndSet, forType.Name, property.Name);
}
continue;
}
if (this.settings.Ignore(property))
{
if (this.log.IsDebug)
{
this.log.Debug(LogMessages.ConventionMappingConvention_IgnoringProperty, forType.Name, property.Name);
}
continue;
}
var isIdentifier = this.settings.IsIdentifier(property);
var columnInfo = new ColumnInfo(
columnName: isIdentifier ? this.settings.ResolveIdentifierColumnName(property) : this.settings.ResolveColumnName(property),
dbType: this.settings.ResolveDbType(property),
propertyInfo: property,
isIdentifier: isIdentifier,
allowInsert: isIdentifier ? identifierStrategy == IdentifierStrategy.Assigned : this.settings.AllowInsert(property),
allowUpdate: isIdentifier ? false : this.settings.AllowUpdate(property),
sequenceName: isIdentifier && identifierStrategy == IdentifierStrategy.Sequence ? this.settings.ResolveSequenceName(property) : null);
if (this.log.IsDebug)
{
this.log.Debug(LogMessages.MappingConvention_MappingColumnToProperty, forType.Name, columnInfo.PropertyInfo.Name, columnInfo.ColumnName);
}
columns.Add(columnInfo);
}
return columns;
}