Ich habe eine schwierige Zeit Zuordnung einer Entität zu einer anderen Entität, die eine Nachschlagetabelle ist.C# Nhibernate Mapping zu Lookup-Tabelle
create table Sources
(
SourceId identity(1,1) primary key not null,
Name [nvarchar](255) NULL,
)
create table Candidates
(
CandidateId int identity(1,1) primary key not null,
SourceId int references Sources(SourceId) NULL,
)
Und Enitites:
public class Candidate : Entity
{
public virtual Source Source { get; set; }
}
public class Source : Entity
{
public virtual string Name { get; set; }
}
Ich erhalte eine Fehlermeldung:
An association from the table Candidates refers to an unmapped class: Entities.Source
Aber ich bin nicht sicher, wie man über die Zuordnung gehen:
public class CandidateMap : IAutoMappingOverride<Candidate>
{
public void Override(AutoMapping<Candidate> mapping)
{
mapping.Map(x => x.Source);
}
}