Castle.ActiveRecord.Framework.Internal.SemanticVerifierVisitor.VisitProperty C# (CSharp) Méthode

VisitProperty() public méthode

Visits the property.
Infer column name and whatever this propery can be null or not Also catch common mistake of try to use [Property] on an entity, instead of [BelongsTo]
public VisitProperty ( PropertyModel model ) : void
model PropertyModel The model.
Résultat void
		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));
			}
		}