Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
Clean way to reference 'current' entity?
Versions des environnements
Network:
Windows 2003 Server
Hi Kevin/Tim/All, me again.
In the Northwind sample application, let's say I wanted to add a button on the employee form that calls oEmployee.ShowLast in Employee.Partial that can do something like console.writeline("The employee LastName is: " + LastName ). (I know it can be done directly from the employee form, but I'm trying to sort out a clean approach to accessing that current row data from the business object.)
I've tried two approaches
1): pass the unique key and within the bizobj create a new emp Employee collection, then do an emp.get based on the primary key. This works but the calling form list becomes the new list of 1 record from the database.
2) in the employee form, do a foreach ent loop through oEmployee.entitylist, looking for the unique key, then set entindex = oEmployee.EntityList.IndexOf(ent), then call oEmployee.ShowLast(oEmployee.EntityList[entindex]) passing the entity.
Both approaches seem suboptimal, seems fundamental, I must be missing something obvious.
Any suggestions?
thanks,
Larry
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement