Version 2.5 - August 27, 2007
.NET 2.0 - SelfServicing
SQL Server 2000
I'm trying to project into a ListOf a custom class (code below). It returns the correct number of records (class objects in the list) but each property is either Nothing or 0. The code looks correct as per the example in the help documentation. I checked the debug output and verified that the SQL code it is using is correct and I have tried GetMultiAsDatatable and it returns the same amount of records into a datatable and the data is returned properly. Can someone help me out?
Imports SD.LLBLGen.Pro
Public Class WeldSpecs
Public Function GetSpotWeldSpecs(ByVal AssyID As Integer) As System.Collections.Generic.List(Of Weld.Business.WeldSpec_Spot)
' Dim WeldSpecCol As New ORM.CollectionClasses.WeldSpec_SpotCollection
Dim filter As New SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression()
'Dim WeldSpecSpotEnt As New Weld.ORM.EntityClasses.WeldSpec_SpotEntity
filter.Add(New SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareValuePredicate(ORM.HelperClasses.WeldSpec_SpotFields.AssyId, SD.LLBLGen.Pro.ORMSupportClasses.ComparisonOperator.Equal, AssyID))
Dim sort As New ORMSupportClasses.SortExpression
sort.Add(New ORMSupportClasses.SortClause(ORM.HelperClasses.WeldSpec_SpotFields.WeldGroup, ORMSupportClasses.SortOperator.Ascending))
' WeldSpecCol.GetMulti(filter, Long.MaxValue, sort)
' WeldSpecCol.GetMulti(filter, Integer.MaxValue, sort)
'SpotDao.GetAsProjection()
' VB.NET .NET 2.0
Dim oWeldSpecs_Spot As New List(Of Weld.Business.WeldSpec_Spot)()
Dim fields As New ORM.HelperClasses.ResultsetFields(2)
fields(0) = ORM.HelperClasses.WeldSpec_SpotFields.AssyId
fields(1) = ORM.HelperClasses.WeldSpec_SpotFields.WeldSpec_SpotId
'fields(2) = CustomerFields.CustomerId
'fields(3) = CustomerFields.Country
Dim projector As New ORMSupportClasses.DataProjectorToCustomClass(Of Weld.Business.WeldSpec_Spot)(oWeldSpecs_Spot)
' Define the projections of the fields.
Dim valueProjectors As New List(Of ORMSupportClasses.IDataValueProjector)()
valueProjectors.Add(New ORMSupportClasses.DataValueProjector("AssyID", 0, GetType(Int32)))
valueProjectors.Add(New ORMSupportClasses.DataValueProjector("WeldSpec_SpotId", 1, GetType(Int32)))
'valueProjectors.Add(New DataValueProjector("CustomerID", 2, GetType(String)))
'valueProjectors.Add(New DataValueProjector("Country", 3, GetType(String)))
' perform the fetch combined with the projection.
Dim dao As New ORM.DaoClasses.WeldSpec_SpotDAO()
'Dim SpotDao As New ORM.DaoClasses.WeldSpec_SpotDAO()
dao.GetAsProjection(valueProjectors, projector, Nothing, fields, filter, Nothing, Integer.MaxValue, sort, True)
Return oWeldSpecs_Spot
End Function
End Class
Public Class WeldSpec_Spot
Public [AssyId] As System.Int32
Public WeldSpec_SpotID As Int32
'Public [WeldGroup]() As System.String
'Public [Quantity]() As Nullable(Of System.Int32)
'Public [NuggetDiameter]() As Nullable(Of System.Decimal)
'Public [UndersizeNuggetDiam]() As Nullable(Of System.Decimal)
'Public [MaxIndent]() As System.String
'Public [MinAcceptanceCriteria]() As System.String
'Public [MaterialThickness_Governing]() As Nullable(Of System.Decimal)
'Public [WeldSetupSize_Required]() As Nullable(Of System.Decimal)
'Public [WeldSpec_Spot_WeldNo]() As Collections.Generic.List(Of WeldSpec_Spot_WeldNo)
End Class