Parameters in Child_Fetch

Parameters in Child_Fetch

Old forum URL: forums.lhotka.net/forums/t/6989.aspx


assetmichael posted on Saturday, May 23, 2009

I have the following objects:

Record =>Editable Parent Object
  RecordDetailList = > Editable Child Object Collection  (
    RecordDetail => Editable Child Object

The RecordDetail has the RecordID as foreign key.

In the ProjectTracker Data Access, the child collection has the following:

Private Sub Child_Fetch(ByVal data As ProjectTracker.DalLinq.Assignment())
    Me.RaiseListChangedEvents = False
    For Each value In data
      Me.Add(ProjectResource.GetResource(value))
    Next
    Me.RaiseListChangedEvents = True
  End Sub

I can't figure out how do i create my Child_Fetch.  What parameter should I use?
Please help.
Thanx.

RockfordLhotka replied on Saturday, May 23, 2009

Child_Fetch() is called by the data portal when your code calls DataPortal.FetchChild().

Standard overloading rules apply, so the data portal will look at the parameters you pass to DataPortal.FetchChild() and it will try to find a Child_Fetch() that takes the same parameter types.

So

DataPortal.FetchChild(Of MyChild)(123)

will invoke

Private Sub Child_Fetch(ByVal id As Integer)

because the type of parameter you pass in matches the type of the parameter of Child_Fetch().

Copyright (c) Marimer LLC