我上课了。当我映射文件也跟着。我只得到IList但我没有得到List(OrderTemp)。 帮助我。
Public Class CusTemp Private _CustomerID As String Private _CompanyName As String Private _ContactName As String Private _ContactTitle As String Private _Address As String 私有_City为字符串 私有_OrderTemp为List(Of OrderTemp)
Public Sub New()
End Sub
Public Property CustomerID() As String
Get
Return _CustomerID
End Get
Set(ByVal value As String)
_CustomerID = value
End Set
End Property
Public Property CompanyName() As String
Get
Return _CompanyName
End Get
Set(ByVal value As String)
_CompanyName = value
End Set
End Property
Public Property ContactName() As String
Get
Return _ContactName
End Get
Set(ByVal value As String)
_ContactName = value
End Set
End Property
Public Property ContactTitle() As String
Get
Return _ContactTitle
End Get
Set(ByVal value As String)
_ContactTitle = value
End Set
End Property
Public Property Address() As String
Get
Return _Address
End Get
Set(ByVal value As String)
_Address = value
End Set
End Property
Public Property City() As String
Get
Return _City
End Get
Set(ByVal value As String)
_City = value
End Set
End Property
Public Property OrderTemp() As List(Of OrderTemp)
Get
Return _OrderTemp
End Get
Set(ByVal value As List(Of OrderTemp))
_OrderTemp = value
End Set
End Property
结束班
mappingfile:
<!--One-to-many mapping: Orders-->
<bag name="OrderTemp" table="Orders" lazy="true">
<key column="CustomerID" />
<one-to-many class="OrderTemp"/>
</bag>
答案 0 :(得分:0)
尝试使用集映射
然后在你的代码中你可以做到
var criteria = Session.CreateCriteria(typeof(OrderTemp))。List();