So, the question is, what is the best way to deal with this? Avoid components and add/manage them manually? Bug SF to enhance the framework to deal with this?
Is there an easier way to do this?
Well, just dropping them on the component was your issue here since it added it to the partial class, which as you already know, will be rebuilt through the BO Mapper. However, you can get around this by manually adding the components in the main class instead of letting the designer decide where to place this. Once you have added it, you should be able to interact with it.
Generally, if this is going to be a common type of control that we will be using over and over again, we will add it to the base business object class. We have one called BoBase in our medical software that all of our BOs inherit from (BoBase inherits from BusinessLayer). But if this is a less common occurance then we may just create a private and expose it through a property. For example, we have some BOs where we want to expose a collection of the children records so we expose the children through a property on the parent BO:
Public Class OrdersBBS
Inherits BusinessBindingSource
Private _Orders As New OrdersBO()
Public Readonly Property Orders As OrdersBO
Get
Return _Orders
End Get
End Property
Public Sub New()
Me.BusinessObject = _Orders
End Sub
End Class
Public Class Customers
Inherits BoBase
Private _Orders As New OrdersBBS()
Public Readonly Property Orders As OrdersBBS
Get
Return _Orders
End Get
End Property
End Class