We're updating the issue view to help you get more done. 

Move relation end-point retrieval from ClassReflectorForRelations to ClassReflector


  • Add IRelationEndPointDefinition IMappingObjectFactory.CreateRelationEndPointDefinition (ReflectionBasedClassDefinition classDefinition, PropertyInfo propertyInfo).

    • Implement by creating a RelationEndPointReflector (use the Create... method) and calling GetMetadata.

  • Add a class RelationEndPointDefinitionCollectionFactory with a CreateRelationEndPointDefinitionCollection method.

    • Implement with code from ClassReflectorForRelations:

      • Copy GetRelationPropertyInfos over to RelationEndPointDefinitionCollectionFactory.

      • foreach (PropertyInfo propertyInfo in GetRelationPropertyInfos (classDefinition)), use the IMappingObjectFactory (injected via ctor) to create a relation end-point.

      • Put the end-points into a collection and return that collection.

  • Add IMappingObjectFactory.CreateRelationEndPointDefinitionCollection, implement by instantiating a RelationEndPointDefinitionCollectionFactory and calling CreateRelationEndPointDefinitionCollection.

  • In ClassReflector.CreateClassDefinition, use IMappingObjectFactory to create and set the end-point collection similar to how it is done with the PropertyDefinitionCollection.

  • Before the tests succeed, RelationReflector must be changed to reuse the end-points created by ClassReflector:

    • Rename CreateOppositeEndPointDefinition to GetOppositeEndPointDefinition.

      • Change the call to _endPointDefinitionFactory.CreateEndPoint to instead look up the end-point on the opposite class definition (oppositeClassDefinition.GetRelationEndPointDefinition (NameResolver.GetPropertyName (new PropertyInfoAdapter (oppositePropertyInfo)))).

      • After the opposite property has been found, use the NameResolver to get the name for the property and look up the property info

    • In GetMetadata, instead of calling CreateEndPoint, look up the end-point on the ClassDefinition. (Extract the code from GetOppositeEndPointDefinition into a GetEndPointDefinition (ClassDefinition, PropertyInfo) method and reuse it here.)

  • Change ClassReflectorForRelations to iterate classDefinition.MyRelationEndPointDefinitions instead of the result of GetRelationProperties(). Remove GetRelationProperties().

    • Remove the call to classDefinition.SetRelationEndPoints from ClassReflectorForRelations.

    • Remove relationDefinitionsForClass.


User known


Fabian Schmied



Time tracking



Fix versions