2 way Projection

Posts   
 
    
Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 20-Sep-2007 21:04:45   

Is it possible to do two way projection (project changes from BO back into the database/DL).

Also, can I project hiearchial data to a BO? So there is a one to many entity relationship and a BO which itself contains a List of custom related business objects.

Thanks !

Dan

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 21-Sep-2007 12:21:49   

Is it possible to do two way projection (project changes from BO back into the database/DL).

It's possible to have 2-way projection.

Also, can I project hiearchial data to a BO? So there is a one to many entity relationship and a BO which itself contains a List of custom related business objects.

In v.2.5, it's now possible to perform a hierarchical projection of a full entity graph, using an entity collection as a startpoint. The projection can be onto a dataset (which will get one datatable per entity type, including datarelations) or a dictionary/hashtable with per type an entitycollection with the projection results per entity type found in the graph.

Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 21-Sep-2007 20:56:29   

Thanks,

You didn't mention projecting into a List<T> object of the parent entitiy with each BO in the list containing a List<T> of the child BO.

I want to go from

ParentEntity 1---Many> ChildEntity

to

ParentBO 1----Many> ChildBO

You mention you can do this in a dataset or dictionary object, but what about a custom class (BO)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Sep-2007 09:14:36   

You could do that. Please go to LLBLGenPro Help - Using generated code - (Adapter || SS) - Fetching Datareaders an projections - Resulset projections - Projecting Dynamic List resultset onto custom classes.

David Elizondo | LLBLGen Support Team
Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 25-Sep-2007 17:40:47   

That doesn't do what I want to do exactly. It is telling me how I can project to a List of Custome Class. This is what I am already doing. I want to take it 1 step further.

I have already used the code snippet from the help as a template to do what I want to do with projection. Here is what I have so far.

If you look at the WeldSpec_Spot class below you will see that there is a WeldSpec_Spot_WeldNo property which is a ListOf WeldSpec_Spot_WeldNo BO's. I want the resultset that is returned to project the data into child lists of the BO for each item in the main list of custom BO's.

Do you know what I mean?

Thanks...

Public Class WeldSpec_Spot

'Public [AssyId] As System.Int32

Private _AssyID As Integer
Private _WeldSpec_SpotID As Integer
Private _WeldGroup As String
Private _Quantity As Nullable(Of System.Int32)
Private _NuggetDiameter As Nullable(Of System.Decimal)
Private _UndersizeNuggetDiam As Nullable(Of System.Decimal)
Private _MaxIndent As System.String
Private _MinAcceptanceCriteria As System.String
Private _MaterialThickness_Governing As Nullable(Of System.Decimal)
Private _WeldSetupSize_Required As Nullable(Of System.Decimal)
Private _WeldSpec_Spot_WeldNo As New Collections.Generic.List(Of Business.WeldSpec_Spot_WeldNo)


Public Property WeldSpec_Spot_WeldNo() As Collections.Generic.List(Of Business.WeldSpec_Spot_WeldNo)
    Get
        Return _WeldSpec_Spot_WeldNo
    End Get
    Set(ByVal value As Collections.Generic.List(Of Business.WeldSpec_Spot_WeldNo))
        value = _WeldSpec_Spot_WeldNo
    End Set
End Property


Public Property WeldSetupSize_Required() As Nullable(Of System.Decimal)
    Get
        Return _WeldSetupSize_Required
    End Get
    Set(ByVal value As Nullable(Of System.Decimal))
        _WeldSetupSize_Required = value
    End Set
End Property

Public Property MaterialThickness_Governing() As Nullable(Of System.Decimal)
    Get
        Return _MaterialThickness_Governing
    End Get
    Set(ByVal value As Nullable(Of System.Decimal))
        _MaterialThickness_Governing = value
    End Set
End Property

Public Property MinAcceptanceCriteria() As System.String
    Get
        Return _MinAcceptanceCriteria
    End Get
    Set(ByVal value As System.String)
        _MinAcceptanceCriteria = value
    End Set
End Property

Public Property MaxIndent() As System.String
    Get
        Return _MaxIndent
    End Get
    Set(ByVal value As System.String)
        _MaxIndent = value
    End Set
End Property

Public Property UndersizeNuggetDiam() As Nullable(Of System.Decimal)
    Get
        Return _UndersizeNuggetDiam
    End Get
    Set(ByVal value As Nullable(Of System.Decimal))
        _UndersizeNuggetDiam = value
    End Set
End Property

Public Property NuggetDiameter() As Nullable(Of System.Decimal)
    Get
        Return _NuggetDiameter
    End Get
    Set(ByVal value As Nullable(Of System.Decimal))
        _NuggetDiameter = value
    End Set
End Property

Public Property AssyId() As Integer
    Get
        Return _AssyID
    End Get
    Set(ByVal value As Integer)
        _AssyID = value
    End Set
End Property

Public Property WeldSpec_SpotId() As Integer
    Get
        Return _WeldSpec_SpotID
    End Get
    Set(ByVal value As Integer)
        _WeldSpec_SpotID = value
    End Set
End Property

Public Property WeldGroup() As String
    Get
        Return _WeldGroup
    End Get
    Set(ByVal value As String)
        _WeldGroup = value
    End Set
End Property

Public Property Quantity() As Nullable(Of System.Int32)
    Get
        Return _Quantity
    End Get
    Set(ByVal value As Nullable(Of System.Int32))
        _Quantity = value
    End Set
End Property

Public Sub New()

End Sub

End Class

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 26-Sep-2007 16:54:47   

If you look at the WeldSpec_Spot class below you will see that there is a WeldSpec_Spot_WeldNo property which is a ListOf WeldSpec_Spot_WeldNo BO's. I want the resultset that is returned to project the data into child lists of the BO for each item in the main list of custom BO's.

I'm confused by the above lines. I don't if you mean by BOs the Entities generated by LLBLGen Pro or some custom classes. So I don't know whther you want to project data from an Entity graph to custom classes, or from custom classes to an entity graph.

Dan1
User
Posts: 41
Joined: 20-Sep-2007
# Posted on: 27-Sep-2007 21:18:48   

I've eventually figured it out myself. Thanks. I just project the data to the custom class and then project the child objects to the List in each class by using a For loop. It's more manual than I thought, but it works.