请参阅下面的NHibernate映射:
public class ProductMap : ClassMapping<Product>
{
public ProductMap()
{
Id<Guid>(x => x.Id);
Property<byte[]>(x => x.ImageData, m =>
m.Type(NHibernateUtil.BinaryBlob)
);
Discriminator(d => d.Column("Description"));
Bag(x => x.Enquiries, collectionMapping =>
{
collectionMapping.Table("PreApproved");
collectionMapping.Cascade(Cascade.None);
collectionMapping.Key(k => k.Column("ProductId"));
},
map => map.ManyToMany(p => p.Column("EnquiryId")));
}
}
描述是鉴别器。现在看下面的查询:
List<Product> products = session.Query<Product>().ToList();
列表中的所有产品的描述均为空。如何确保填充?我是否必须为鉴别器创建另一个字段?