Помогите мне получить список <Customers>вроде следующего в nhibernate? - PullRequest
0 голосов
/ 17 июня 2010

У меня следующий классКогда я сопоставляю файл также следующий.Я получаю только IList, но не получаю List (of OrderTemp).Помогите мне.

Открытый класс CusTemp Private _CustomerID As String Private _CompanyName As String Private _ContactName As String Private _ContactTitle As String Private _Address As String Private _City As String Private _OrderTemp As 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

Конечный класс

файл сопоставления:

<!--One-to-many mapping: Orders-->
<bag name="OrderTemp" table="Orders" lazy="true">
  <key column="CustomerID" />
  <one-to-many class="OrderTemp"/>
</bag>

1 Ответ

0 голосов
/ 18 июня 2010

Попробуйте использовать отображение набора

Тогда в вашем коде вы можете просто сделать

var crit = Session.CreateCriteria (typeof (OrderTemp)). List ();

...