Reputation: 11875
I am building my applicaiton using nhibernate 3.2 and s#arp lite framework.
Id: int (PK)
Title: string
PostBy: int (FK, User table Id)
I am using automapping, by convention its looking for UserID which does not exist. I need to override this.
here's my code, it doesn't work, please help me to fix it.
internal class StackOverride : IOverride
{
public void Override(ModelMapper mapper)
{
mapper.Class<Stack>(s =>
{
s.Property(x => x.PostBy, map => map.Column("PostBy"));
});
}
}
Upvotes: 0
Views: 596
Reputation: 11875
finally figure it out how to do it. here's the code.
public void Override(ModelMapper mapper)
{
mapper.Class<Stack>(map =>
map.ManyToOne(
x => x.PostBy,
manyToOne =>
{
manyToOne.Column("PostBy");
}));
}
Upvotes: 1