public override void VisitProperty(PropertyModel model)
{
if (model.PropertyAtt.Column == null)
{
model.PropertyAtt.Column = model.Property.Name;
}
// Append column prefix
model.PropertyAtt.Column = columnPrefix + model.PropertyAtt.Column;
Type propertyType = model.Property.PropertyType;
if (NHibernateNullablesSupport.IsNHibernateNullableType(propertyType) &&
(model.PropertyAtt.ColumnType == null || model.PropertyAtt.ColumnType.Length == 0))
{
model.PropertyAtt.NotNull = false;
model.PropertyAtt.ColumnType = NHibernateNullablesSupport.GetITypeTypeNameForNHibernateNullable(propertyType);
}
if (propertyType.IsGenericType &&
propertyType.GetGenericTypeDefinition() == typeof(Nullable<>) &&
String.IsNullOrEmpty(model.PropertyAtt.ColumnType))
{
model.PropertyAtt.NotNull = false;
model.PropertyAtt.ColumnType = ObtainNullableTypeNameForCLRNullable(propertyType);
}
if (ActiveRecordModel.GetModel(propertyType) != null)
{
throw new ActiveRecordException(String.Format(
"You can't use [Property] on {0}.{1} because {2} is an active record class, did you mean to use BelongTo?",
model.Property.DeclaringType.Name, model.Property.Name, propertyType.FullName));
}
}