2011-09-23 42 views
0

我通過nHibernate在懶惰集合中查詢項目。查詢項目而不提取集合。但是當我嘗試創建HashedSet爲什麼HashedSet強制加載延遲集合?

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

從這些項目中提取所有懶惰的東西。是什麼造成的?

[Serializable] 
    public class Thing { 
     public virtual String Name { get; set; }  
     public Thing() { 
      OtherThings = new HashedSet<OtherThing>();    
     } 

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

你能告訴我們你從哪裏得到'Items'和ityemtype的代碼嗎? – Firo

回答

1

也許你已經在實體(或基類的話)覆蓋GetHashCode()有訪問屬性?