CustomersBO.OrdersBO.OrderItemsBO.ItemPrice
How can I do that for SF Business Object?
Thanks, the code is pretty understandable. About the third option, this where a function like SCATTER MEMVAR BLANK would do the trick on initializing the empty row, unless I am just missing the simple point on using the BO.NewRow() to have a blank row with no values, so any use of its property will not throw an error. I will test that.
Also thanks for the points about not using the descriptors, you are right and these are not needed for this kind of properties.
All the time I simply get amazed with how functionality that seems pretty difficult or hard to do are accomplish in the .NET world and of course SF with a couple of line of code.
This is getting better when changing the code as follow:
Private
Public ReadOnly Property [InsuranceCompany]() As InsuranceCompanyBO
Get
_insuranceCompany.FillByPrimaryKey(
_insuranceCompany.NewRow()
I now get an error when trying to use this property in a code like this:
Dim
Look at the attached image for the error: NullReferenceException was unhandled by user code. Object reference not set to an instance of an object.
What I understand about this error is that I would need to create an instance of this object in order to use this property, while when using the original method there was not need to do that, guess because previous method was always creating an instance of the class with this code:
Dim loLookupBO As New InsuranceCompanyBO
So far, the error has nothing to do with setting values to the created new row. When using BO.NewRow() SF will populate it with the default values which are good enough in my case.
In order to make it work I added a "New" command to initialize the Private BO variable like this:
Then I made some changes to the property code to make sure the BO is filled all the time, like this:
_insuranceCompany.CurrentDataTable.AcceptChanges()
So far the code above is working fine.