JVCL Help:DP SelectConsumerContext

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Selects a new consumer and context.

run\JvDataProvider.pas


Pascal

 run\JvDataProvider.pas
 procedureDP_SelectConsumerContext(Provider: IJvDataProvider; Consumer: IJvDataConsumer; Context: IJvDataContext);


Parameters

Parameters Description
Provider: IJvDataProvider Reference to the IJvDataProvider to select a new consumer and context for.
Consumer: IJvDataConsumer Reference to the consumer to select as the active consumer.
Context: IJvDataContext Reference to the context to select as the active context.

run\JvDataProvider.pas


Description

DP_SelectConsumerContext selects a new consumer and context pair as the active consumer and context of a provider. The current consumer and context are pushed onto a stack. Use DP_ReleaseConsumerContext to return to them. When the provider is created no consumer is selected.
This routine in combination with DP_ReleaseConsumerContext allows the selection/deselection of a consumer and it's active context to be performed atomically. If one of the selection action fails, the other will be reverted automatically.
Most consumers will use this routine to select itself and it's associated context into the provider before making other requests from the provider.
It's highly recommended to keep the timespan of the selection as short as possible, i.e. select the consumer/context, access the provider, release the consumer/context and always guard the code between selection and release with a try/finally to make sure the release of the consumer/context takes place:
DP_SelectConsumerContext(Provider, Consumer, Context);
try

  ... access the provider here ... 
finally
DP_ReleaseConsumerContext(Provider);
end;

run\JvDataProvider.pas


See Also

DP_ReleaseConsumerContext, IJvDataProvider.SelectConsumer, IJvDataProvider.SelectContext

run\JvDataProvider.pas


About

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page