开发者

Why HashedSet forces loading lazy collection?

I query items with lazy collections in via nHibernate. Items are queried without fetching collections. But when i try to create HashedSet

var hashedSet = new HashedSet<Thing>(Session.Query<Thing>()) 

from those items all lazy stuff is fetched. Whats causing that?

 [Serializable]
    public class Thing {
        public virtual String Name { get; set; }       
        public Thing() {
            OtherThings = new HashedSet<OtherThing&开发者_如何学Gogt;();              
        }

        public virtual ISet<OtherThing> OtherThings { get; set; }
  }


Maybe you have overridden GetHashCode() in the entity (or any base class of it) and access the properties there?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜