Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Some improvement ideas for CCursor class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00645646
Message ID:
00646321
Vues:
21
>Hi Kevin,
>
>I will just jump in this thread. Preparing training material on BO principles (before looking at MM BOs) I also fell over this question.
>I would suggest a BizObj to have two more methods one for "locate or search" and perhaps one for Filter.
>THis fits in the responsibility of BizObj with DataAccess Obj.
>
>BOs have methods for DataNavigation so why not also for Search or Locate ?
>Like DataNav (First, Next) these methods would only work on loaded data.
>I believe that would really help out at a few point.
>
>Looking forward to hear your ideas
>Regards
> Marcus
>
>
>E.G. I did a ASP example (god! never let me do somthiong like that again).
>There I dropped over the fact that I wanted the BO to navigate through data.
>But beeing stateless meant I before I could call Next... I had to get the
>RecordPointer back to the record I was before (took SetRecNum knowing this is not really the way to do).
>It would have been great if I just have had a Search method to position on the last ID I got !

Generally, the only time I need something like this is when I'm dealing with child records. If it's a parent, it's probably only a single record (filtered on the PK). There are exceptions, of course, but it's usually the case. If you need to filter/find/locate in a bizobj that returns multiple records, which field should it filter on? The PK? A foreign key? Something else? Since we don't know ahead of time, this would have to be a shell method that you would override in each bizobj subclass. I used to have different methods in my bizobjs that would query/filter/locate/find on different parameters, then I would just call that particular method with the parameters. That worked, but it was kind of a pain. Now that the framework includes generic methods to requery any view in the DE, those methods aren't really needed. I just add code to the PostInitHook() to add my view parameters, then call the bizobjs Requery() method. This accomplishes the same goal. The one advantage for a generic query/fiilter/locate/find is that the data is already loaded, so it might be faster than issuing a new query for a single record. But that ones really dependent on the number of records in the data, if it's indexed, etc.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform