Consider following 2 classes:
public class TypeAGood{
public virtual int Id{get;set;}
public virtual string Description{get;set;}
public virtual Type Type{get;set;}
}
public virtual class Type{
public virtual int Id{get;set;}
public virtual string Name{get;set;}
}
mappings:
public class TypeMap : ClassMap<Type>
{
public TypeMap()
{
Table("Type");
Id(x => x.Id);
Map(x => x.Name);
}
}
public class TypeAGoodMap : ClassMap<TypeAGood>
{
public TypeAGoodMap()
{
Table("Good");
Id(x => x.Id);
Map(x => x.Description);
References(x => x.Type)
.Fetch.Join()
.Column("TypeId")
.ForeignKey("Id");
}
}
Type could have different values like a,b,c.
How can I change the TypeAGoodMap to only map the goods which have Type a?
Thanks,
Al