StrataFrame Forum

Best Practices for BO Design

http://forum.strataframe.net/Topic7208.aspx

By Ben Kim - 2/28/2007

Hello,

I have created a BO that needs to look to another record in the same table for additional information.  This table contains a list names.  However, each record can point to an alias record.  The information I need is basic for the "main" record (Name, SSN, Birthdate, etc.).  I assume that the best place to handle this lookup is in the CheckRulesOnCurrentRow.  However I do not want to move any pointers or make a mess out of the existing dataset.  Can I use a "Get" method to obtain this information and how would one do the following:

Current Record ID: 96
First Name: John
Last Name: Doe
BirthDate: 1/15/1968
Alias ID: 52
etc.

Alias Record ID: 52
First Name: The "Man"
Last Name: NULL
BirthDate: 3/2/1970

How would I do the assignments after looking up?

NamesBO.GetByAliasID(NamesBO.AliasID)
Me.AliasFirstName = ?  <--- what goes here?
Me.AliasLastName = ?

The alias first name, last name, DOB, SSN, etc. need to be populated to custom properties for the UI designer to use.

Or can I create a new BO within the base BO to obtain this information?

Thank you for your help!

Ben

By Ben Hayat - 2/28/2007

Why don't you use a second BO for the second record? This way your first one stays in place!
By StrataFrame Team - 2/28/2007

Yes, as Ben said, you can create a second business object to gather the comparison record that you need.  A Get would also retrieve the data, but it is only going to return a DataTable (no strong-typing).  As for moving the record pointer, if you do, it doesn't matter... the internal method iterating through the rows for the CheckRulesOnCurrentRow event uses the MoveAbsolute() method internally, so you can be assured that on the next raising of the CheckRulesOnCurrentRow event, the CurrentRowIndex will be in the correct place.
By Ben Kim - 2/28/2007

I wasn't sure that was allowed within the BO "Class" itself w00t.  I will give it a shot.  Thanks guys!
By Trent L. Taylor - 2/28/2007

The MyBO.vb file specifically for you to add all of your custom code.  Just do not change the MyBO.Designer.vb file as this will be overwritten the next time the partial class is built through the BO Mapper.