Hi,
I'm trying to figure out the best way to handle descriptive lookup values associated with foreign keys on a business object. I've read some of the past discussions (e.g. http://forum.strataframe.net/Topic12507-7-1.aspx?Highlight=RowPopulating+browse) and it is looking like custom field properties may be the way to go in many cases.
For example, I have a staffBO for all teachers in a school district. Each record has an FK_School foreign key pointing to the teacher's school. On my StaffMaintenanceForm Browse Dialog I want the school title (not FK) to show in the results column. So I added a cSchoolTitle custom field to StaffBO as shown below (using a call to SchoolBO.FillByPrimaryKey()).
This works fine, but I'm concerned about the speed and network demands of repeatedly doing a FillByPrimaryKey() each time a staff record is retrieved. I'm also trying to better understand what is going on behind the scenes, so please bear with me...
Does the FillByPrimaryKey() actually query the backend School table for each staff record?... or is some fancy buffering going on? I know doing this for a few hundred staff records may be trivial, but other tables with similar lookup requirements may have 10,000 records.
Is there a better way to just pull the entire School table into a local BO one time (using FillAll()) and look up the school titles there? Would this alternate approach be preferable for small lookup tables?
I've considered using a multi-table BO (based on SQL views that have joins to needed lookup tables) but was stymied by how to make these updatable.
Thanks in advance,
Larry
Public ReadOnly Property [CSCHOOLTITLE]() As System.StringGetDim schoolbo As New SchoolBOschoolbo.FillByPrimaryKey(
Me.FK_SCHOOL)If schoolbo.Count = 1 ThenReturn schoolbo.CTITLEElseReturn String.EmptyEnd Ifschoolbo.Dispose()
End GetEnd Property