GetDependentRelatedEntities Question

Posts   
 
    
hlesesne avatar
hlesesne
User
Posts: 47
Joined: 22-Jul-2004
# Posted on: 05-Feb-2005 18:49:44   

If I have the following tables

CustomField PK CustomFieldID FK ItemID FK FIeldID Value Sort

Field PK FieldID Name

Item PK ItemID Name Description Price

They are related this way

[Field] <--1:m [CustomField] m:1--> [Item]

So that CustomField is m:1 Item and CustomField is m:1 Field

The problem that I am having is that when I use the following code:


            For Each Entity As EntityBase In CustomField.GetDependentRelatedEntities
                 ' Do stuff with each of the dependant entities
            Next

I only have a dependant entity for Item, not for Field. I checked the constraints and they are vitually identical, I am wondering if this might just be a code generation problem, but wanted to query you guys first to make sure that I wasn't misusing the GetDependantRelatedEntities method.

One additional thing regarding this item. This function:

        Public Overrides Function GetDependentRelatedEntities() As ArrayList
            Dim toReturn As New ArrayList()

            ' each related entity which is dirty, is added to the collection, and will be saved first.
            If Not _field Is Nothing Then
                toReturn.Add(_field)
            End If
            If Not _item Is Nothing Then
                toReturn.Add(_item)
            End If

            Return toReturn
        End Function

is what fires and _field is always nothing, while _item is an ItemEntity. I am beginning to think that I am looking for the wrong results from this method. Any help would be greatly appreciated.

Best Regards and thanks for the help.

Hal

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 05-Feb-2005 21:57:34   

That routine only returns the objects which are actually set as related. So if I do: CustomField.Field = someinstance;

then I only get someinstance, not an instance for item.

The routine is used to find related entities in memory, in the graph, for saving.

Frans Bouma | Lead developer LLBLGen Pro