Nhibernate 为什么HashedSet强制加载惰性集合?
我通过nHibernate查询具有惰性集合的项目。查询项目时不提取集合。但是当我尝试创建HashedSet时Nhibernate 为什么HashedSet强制加载惰性集合?,nhibernate,lazy-loading,Nhibernate,Lazy Loading,我通过nHibernate查询具有惰性集合的项目。查询项目时不提取集合。但是当我尝试创建HashedSet时 var hashedSet = new HashedSet<Thing>(Session.Query<Thing>()) var hashedSet=新hashedSet(Session.Query()) 从这些项目中提取所有懒惰的东西。是什么原因造成的 [Serializable] public class Thing { pub
var hashedSet = new HashedSet<Thing>(Session.Query<Thing>())
var hashedSet=新hashedSet(Session.Query())
从这些项目中提取所有懒惰的东西。是什么原因造成的
[Serializable]
public class Thing {
public virtual String Name { get; set; }
public Thing() {
OtherThings = new HashedSet<OtherThing>();
}
public virtual ISet<OtherThing> OtherThings { get; set; }
}
[可序列化]
公共类事物{
公共虚拟字符串名称{get;set;}
公共事物{
OtherThings=新HashedSet();
}
公共虚拟ISet OtherThings{get;set;}
}
可能您已经重写了实体(或其任何基类)中的GetHashCode()
,并访问了那里的属性?您能告诉我们从哪里获取项以及ityemtype的代码吗?