We are using the LLBLGen product to translate a normal database structure into a generic set of tables. For example, a single field is represented in a table called an Act. One of the properties of the Act is the field name and another property is the value. All of the database tables and fields are stored in this manner, but some have different tables such as "Entity (not to be confused with a LLBLGen entity)", and "Role". Parent-child relationships are mapped using intermediate tables such as "ActRelationship". Thus, a normal child table of 10 fields will have 10 Act records and each will have an ActRelationship record to relate it back to the parent. The code I have constructed is as follows:
Dim ActParent as New ActEntity(Id)
Dim ActChild as New ActEntity
Dim ActRel1 As ActRelationshipEntity
Dim ActInt As ActEntity
Dim bHasActObs As Boolean
For Each ActRel1 In ActParent.ActRelationships_Source
If ActRel1.TypeCode = "COMP" Then
ActInt = ActRel1.Act_Target
With ActInt
If .ClassCode = A_UNIQUE_FIELD_NAME And .Code = "REF" Then
bHasActObs = True
Exit For
End If
End With
ActInt = Nothing
End If
ActRel1 = Nothing
Next
If Not bHasActObs And SetIfNotFound Then
ActInt = New ActEntity
With ActInt
.ClassCode = A_UNIQUE_FIELD_NAME
.Code = "REF"
End With
ActRel1 = New ActRelationshipEntity
With ActRel1
.TypeCode = "COMP"
End With
End If
If Not ActRel1 Is Nothing And Not ActInt Is Nothing Then
With ActRel1
.Act_Source = ActParent
.Act_Target = ActInt
End With
End If
Dim ActRel2 As ActRelationshipEntity
Dim blnHasRelationship As Boolean
For Each ActRel2 In eAct.ActRelationships_Source
If ActRel2.Target_ID = Me.ID And ActRel2.TypeCode = "COMP" Then
blnHasRelationship = True
Exit For
End If
ActRel = Nothing
Next
If Not blnHasRelationship Then
ActRel2 = New ActRelationshipEntity
ActRel2.TypeCode = "COMP"
End If
If Not ActRel2 Is Nothing Then
ActRel2.Act_Source = eActInt
ActRel2.Act_Target = Me
End If
ActParent.Save(True)
I am using VB.NET ASP and LLBLGEn in SelfServicing mode. On a typical web page I would store approximately 30-50 fields in this manner. When I save the ActParent some of the child fields do not get recognized and saved. Is there anyway I can break the process in debug mode and see where the linking is breaking down at?