我需要在 NHibernate 3 主干版本中急切加载 Linq 的帮助。
我有这样的多对多关系:
public class Post
{
public int Id {get;set;}
public IList<Tag> Tags { get;set;}
.
.
.
}
现在我在 Fluent NHibernate 中有以下映射
public class PostMap:ClassMap<Post>
{
public PostMap()
{
Table("Posts");
Id(x => x.Id);
.
.
HasManyToMany(x => x.Tags)
.Table("PostsTags")
.ParentKeyColumn("PostId")
.ChildKeyColumn("TagId")
.Not.LazyLoad(); // this is not working..
}
}
现在,在获取帖子时,我还需要标签来热切加载。我知道使用 Criteria API 和 HQL 是可能的,而我应该使用 SetFetchMode。但是在使用 Linq 时有没有办法使用 SetFetchMode?