If I start by pointing you to this question here, which was perfectly answered for what I needed, only for one problem of trying to be able to point a transaction back to the client.
Is anyone able to help with this? Thanks again in advance.
You need bi-directional association. This means that Client
has a reference to Transactions
and visa versa.
You already have the Client to Transactions covered. There is nothing in the implementation of List Of(T)
that will provide a reference from the child elements to the parent (Or to the parent of the List to be more accurate).
You have provide the implementation yourself. One approach is:
Public Class Transaction
Private ReadOnly _client as Client
Sub New (client As Client)
_client = client
End Sub
End Class
Thereby enforcing the rule that each transaction should be associated to a client.
Usage would then be:
Dim cl as new Client()
cl.Transactions.Add(new Transaction(cl))