NHibernate-映射组件集合?

NHibernate-映射组件集合?,nhibernate,nhibernate-mapping,Nhibernate,Nhibernate Mapping,我有下面的DB表 CREATE TABLE ProductPrice ProductID Qty1 Price1 Qty2 Price2 Qty3 Price3 我的域类如下所示 Class ProductPrice ProductID As Integer PriceBands As IList(of PriceBand) End Class Class PriceBand Qty As Integer Price As Decimal End

我有下面的DB表

CREATE TABLE ProductPrice
  ProductID
  Qty1
  Price1
  Qty2
  Price2
  Qty3
  Price3
我的域类如下所示

Class ProductPrice
  ProductID As Integer
  PriceBands As IList(of PriceBand)
End Class

Class PriceBand
  Qty As Integer
  Price As Decimal
End Class
我知道我们可以使用“组件”映射将一行映射到不同的对象,但是否可以如上所述映射对象集合

非常感谢


James

我认为在字段名称末尾看到1,2,3通常是数据库设计不好的标志,因此如果NH支持这一点,我会有点惊讶。

如果可以,请将数据库规范化为两个表-产品和产品价格(每一行包含该数量的产品ID、数量和价格带,insead有3对列)。然后您可以轻松地将它们映射为集合(包)在NHibernate中匹配您的应用程序模型类。

您不希望使用映射到适当表的真实集合有什么原因吗?这将是推荐的解决方案。恐怕这是一个遗留表,所以我不得不使用它。我显然不会这样设计:)正如我上面所说,我无法更改表设计。有没有办法进行手动映射?