Using a BusinessLayer to fill a specific BO


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Can I use a generic BusinessLayer to fill a specific BO if the datatable in the BusinessLayer is filled in a way that the BO can handle?



I.e. I have a CustomersBO with these fields:



CustID

CustName



Then I instantiate a BusinessLayer and use FillDataTable with SQL like this:



Dim bo As New BusinessLayer()

bo.FillDataTable("Select CustID, CustName From Customers")




Can I then do:



CustomersBO.CopyDataFrom(bo,ClearAndFillFromCompleteTable)

Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Paul's option is a good one and it does save the overhead of instantiating another business object.

But, a business object can store data that does not match it's strong-typed properties, so you could really use any business object and fill it.  Just don't go trying to access those strong-typed properties that don't have a backing field, or you'll get a nice exception Wink

Using Paul's option is cleaner.

Oh, and there's also the CopyDataFrom() and MergeDataFrom() overloads that accept DataTable parameters if you won't want to use the Load method directly on the CurrentDataTable.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks for the reply Ben. It is all making sense now. I haven't done much at the data layer directly, so I appreciate Paul's comments a lot!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Greg McGuffey - 19 Years Ago
     bump...
Greg McGuffey - 19 Years Ago
Paul Chase - 19 Years Ago
Greg McGuffey - 19 Years Ago
                     Paul's option is a good one and it does save the overhead of...
StrataFrame Team - 19 Years Ago
                         Thanks for the reply Ben. It is all making sense now. I haven't done...
Greg McGuffey - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search