Components on BOs


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks. I think I just add the component manually to the main BO file.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I have several BOs were I've dropped a component onto the design surface. The component extends the BO and was a very easy way to deal with it.



Today, I was going crazy updating the field descriptors (way cool) and the BOs with these components all broke because the component had been added to the designer file by VS, which of course was rebuilt when the descriptors were changed, and thus my components were gone. I fixed it by simply re-adding the components. But I'm wondering if there is a better way...



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? Wink Is there an easier way to do this?



Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search