title: FluentNHibernate query on many-to-many relationship objects
body: <p>For some reason i can't get this query right, and i can't understand why...</p>
  
  <p>I have an object called 'Blog' that has an Id, and a list of 'Tag's.<br/>
  Each 'Tag' has an id and a 'Name' property.</p>
  
  <p>Since this is a many to many relationship, I have another table called 'blog_tags' connecting them.</p>
  
  <p>The mappings look like this :</p>
  
  <pre><code>public class BlogsMapping : ClassMap&lt;Blog&gt;
  {
      Table("blogs");
      Id(x =&gt; x.Id).GeneratedBy.Identity();
      Map(x =&gt; x.Content);
      HasManyToMany(x =&gt; x.Tags)
          .Table("Blog_Tags")
          .ParentKeyColumn("BlogId")
          .ChildKeyColumn("TagId")
          .Not.LazyLoad()
          .Cascade.All();
  }
  
  public class TagsMapping : ClassMap&lt;Tag&gt;
  {
      Table("tags");
      Id(x =&gt; x.Id).GeneratedBy.Identity();
      Map(x =&gt; x.Name);
  }
  </code></pre>
  
  <p>I would like to retrieve a list of blogs that have all of the following (some list) of tags.</p>
  
  <p>I would like to do something like this :</p>
  
  <pre><code>public IList&lt;Blog&gt; Filter(string[] tags)
  {
      var blogs = _session.QueryOver&lt;Blog&gt;()
          .Where(x =&gt; x.Tags.ContainsAll(tags));
      return blogs.ToList();
  }
  </code></pre>
  
  <p>I tried a couple of different ways, but always run into different and weird errors, so i was hoping that someone could just point me in the right direction...</p>