We have a situation where we want to define a relationship where a class (named Module) may or may not be related to a Module object that is a predecessor to it. There can be zero or none predecessors. The class looks like this:
public class Module { public int Id { get; set; } // other stuff here public Module Predecessor { get; set; } }
And we have defined our mapping so that Predecessor is a property of type Module like so:
<class name='Module'> <Id name='Id'> <generator class='native/> </Id <property name='Predecessor' type='Module' 'unique='true'/> <class>
However we are getting complaints about the mapping not being able to compile because it cannot find the type ‘Module’. We have tried the long name for the class
type='STC.EI.JobSubmissionSystem.Data.Domain'
and the fully-qualified name for the class
type='STC.EI.JobSubmissionSystem.Data.Domain, STC.EI.JobSubmissionSystem.Data'
to no avail. My question is:
Are we mapping this properly, and if not then how do we map it properly?
You could use the many-to-one element:
Note that you need a column in your table to define the relation.