0
我有一個Nhibernate投影列表問題, 它一直說它無法找到類'Label6.Domain.Product'中屬性'Commname'的setter或無法解析屬性「pl.commname」 屬性「commname」是對象productslangs的一部分。Nhibernate ProjectionList問題
我的產品對象是這樣的:
Public Overridable Property Latinname() As System.String
Get
Return _Latinname
End Get
Set(ByVal value As System.String)
_Latinname = value
End Set
End Property
Public Overridable Property Latinname2() As System.String
Get
Return _Latinname2
End Get
Set(ByVal value As System.String)
_Latinname2 = value
End Set
End Property
Public Overridable Property productslangs() As IList(Of Productslang)
Get
Return _productslangstrong text
End Get
Set(ByVal value As IList(Of Productslang))
_productslangs = value
End Set
End Property
我的標準是這樣的
Dim crit As ICriteria = session.CreateCriteria(Of Product)()
crit.Add(Expression.In(Projections.Property("ID"), aryIds))
crit.CreateAlias("productslangs", "pl")
crit.Add(Expression.Eq("pl.LangId", systemSettings.setting.langId))
crit.SetFetchMode("Product.productslangs", FetchMode.Eager)
crit.SetProjection(Projections.ProjectionList() _
.Add(Projections.Property("ID"), "ID") _
.Add(Projections.Property("this.Latinname"), "Latinname") _
.Add(Projections.Property("this.Matchcode"), "Matchcode") _
.Add(Projections.Property("this.Price"), "Price") _
.Add(Projections.Property("this.Productgroup"), "Productgroup") _
.Add(Projections.Property("this.colorLookUp"), "colorLookUp") _
.Add(Projections.Property("this.Productsubgroup"), "Productsubgroup") _
.Add(Projections.Property("pl.Commname"), "Commname")
)
list = crit.SetResultTransformer(Transform.Transformers.AliasToBean(Of Product)).SetCacheable(True).List(Of Product)()
有誰能夠告訴我在做什麼錯?
好的非常感謝我會盡力。 我試圖完成的唯一事情是在網格中獲得我需要的特定字段。 – 2011-05-24 07:17:12