> Is it better to instantiate the component, save the values someplace, then release it.
> Then instiate it again, read the values, etc... or is it better to instantiate the
> component and keep using the same one.
COM+ is stateless, and it's always a mistake to try to make it any other way.
> However, you are correct that you'll only call SetComplete()
> when you have totally finished using that instance of the component.
I disagree: apart from ignoring SetComplete's function of notifying COM+ that a transaction can be committed, use of SetComplete allows COM+ to scale. The object isn't released until the application's idle shutdown
timeout is reached. Each server call should make no assumptions about state, obtain a context reference at the start, and call SetComplete at the end (or SetAbort if needs be). That's how COM+ works best.
In a crude way - what if the user leaves your app open when going to lunch but then goes straight home feeling ill? Your server object will sit there until the app is closed when the user returns.
>My reading tells me that the call to SetComplete() tells the component
> the client is finished with it, and it may end up cleared from server memory.
Yes, if there are no further calls from the original client, or any other client. COM+ caches the object, though, for when it's called next.
> I have a server-based component designed to perform some app-specific searches,
> which is called from the client form. If I want to have the same client
> use the component for multiple calls to these search methods over a long
> data entry session, should SetComplete() be used at the conclusion of these methods like that?
Yes, very much so. In my opinion.
Regards
Stuart