I want to join 2 tables. They do not have foreign keys, but they have a column which have the same content. I cant change the schema and here is a simplified example:
public class Person{
public virtual string Name{get;set;}
public virtual int Id{get;set;}
public virtual char Gender{get;set;} #this one I want to connect
}
public class PersonMapping : ClassMapping<Person>{
public PersonMapping()
{
Id(x=>x.Id);
Property(x=>x.Name);
Property(x=>x.Gender);
}
}
public class Gender{
public virtual char ShortName{get;set;} #to this. So they are the same. When They are connected I want to access the Other properties of this class
public virtual int Id{get;set;}
public virtual string LongName{get;set;}
}
public class GenderMapping: ClassMapping<Gender>{
public GenderMapping()
{
Id(x=>x.Id);
Property(x=>x.ShortName);
Property(x=>x.LongName);
}
}
Now I want to have all persons with the corresponding Gender. So that I can find the long name. I think the solution is something like this but it is for fluent nhibernate. I would also be fine to do that with criterias or similar.