private Property CreateProperty(SimpleValue value, string propertyName, System.Type parentClass, HbmKeyProperty keyPropertySchema) { if (parentClass != null && value.IsSimpleValue) { value.SetTypeUsingReflection(parentClass.AssemblyQualifiedName, propertyName, keyPropertySchema.access ?? mappings.DefaultAccess); } // This is done here 'cos we might only know the type here (ugly!) var toOne = value as ToOne; if (toOne != null) { string propertyRef = toOne.ReferencedPropertyName; if (propertyRef != null) { mappings.AddUniquePropertyReference(toOne.ReferencedEntityName, propertyRef); } } value.CreateForeignKey(); var prop = new Property { Value = value }; BindProperty(keyPropertySchema, prop); return(prop); }