Where clause in Fluent NHibernate Many-to-Many

Posted by Adam Albrecht on Stack Overflow See other posts from Stack Overflow or by Adam Albrecht
Published on 2010-02-10T16:06:12Z Indexed on 2010/04/21 5:43 UTC
Read the original article Hit count: 239

Filed under:
|
|
|
|

I am trying to setup a many-to-many mapping in Fluent Nhibernate that has a where clause attached to the child table.

This is basically how it should work:

HasManyToMany(p => p.Images)
  .Table("ProductImages")
  .ParentKeyColumn("ProductID")
  .ChildKeyColumn("ImageID")
  .Where("ImageTypeID = 2");

The ImageTypeID column is in the Images table, but NHibernate is assuming it is part of the ProductImages table. Any idea how I can specify this?

Thanks!

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate