Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My first Biz Object - Base it on the data session class?
Message
From
05/01/2001 11:04:39
 
 
To
05/01/2001 08:52:07
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00459750
Message ID:
00459829
Views:
22
Mark,

>1. I have been told that the new data session objects make the ideal foundation to base a biz object on. Is this so?

Some people still base business objects on "custom", or even "line" since it is very lightweight. However, Session is usually well-suited for making a class that can be used very flexibly in various situations.

>2. I will not be able to use a VCX based class for this so where is the ideal place for the code that creates the class. a) In a PRG file as part of the project or b)As part of my application procedure file.

For generic business object code, such as adding, editing, updating records, you would probably have a prg containing your "base" subclass of Session, with various SET commands for environment in the INIT(), and methods to carry out various generic functions.

Some of those could be "stub" methods, such as a Validate() which contains nothing but RETURN .t. in your top-level class, but would have code added in specific subclasses for specific entities or tables. Other "stubs" might be hooks to allow flexibility, such as BeforeSave(), AfterSave(), etc...

But you asked where to put the code, didn't you? I guess you'd think of it just as you would if you were dealing with VCX-based classes, where you'd have some generic library classes added to multiple projects and specific subclasses of those in other VCX's added to specific projects.

Here you might have a prg with your generic Session subclass level, then another prg with multiple subclasses. You could, of course put them all into one prg, but that would complicate reuse of your generic stuff.

In a nutshell, it boils down to personal preference once you have considered issues of reuse.

>3. The amount of information I have been able to find the Data Session Class is small as it only came out as part of SP3. I can find no articles here in UT about how to use it.

It's simple, really, so there's not much to discuss other than architectural issues as above. When instantiated, a class based on Session sets up a private data session by default and shuts it down when the class is destroyed. This environment is separate related to things like SET EXCLUSIVE, etc, so your Init() should take care of the proper settings.

A search of Wikki on 'Data Session Object' produces nothing
>and the amount of info provided by MS can only be described as pitiful. Can anyone pint me at an article discussing is use with an example:) ?

You might try looking just for "Session" or "Session Class".

Here is a Knowledgebase article: http://support.microsoft.com/support/kb/articles/Q248/1/16.asp

Here is a small wiki topic:
http://fox.wikis.com/wc.dll?Wiki~SessionClass~VFP

>
>My delivery deadline for the rest of the app is getting close so I have to decide today how to write this part of the code. I don't want to do it the old fashioned way unless I have to.
>
>Many Thanks
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform