CCR Extension Methods
Glossary Item Box
To simplify programming with CCR, several extensions are defined on the DispatcherQueue class. These are visible through Intellisense. Equivalents to a lot of these methods are available in DSS via the DsspServiceBase class, so they are only relevant when programming with CCR outside the DSS environment. For example, in CCR:
Ccr.Core.DispatcherQueue q = new DispatcherQueue();
yield return q.TimeoutPort(100).Receive();
is equivalent to the following code in a DSS service (and even the base.TaskQueue is optional):
yield return base.TaskQueue.TimeoutPort(100).Receive();
The following table lists all of the Extension Methods.
|
Extension Method |
Parameters |
Description |
|---|---|---|
|
void Spawn |
Handler handler |
Invoke a message handler asynchronously that does not take any arguments. |
|
void Spawn<T0> |
T0 t0, |
Invoke a message handler asynchronously, supplying a single argument explicitly. |
|
void Spawn<T0, T1> |
T0 t0, |
Invoke a message handler asynchronously, supplying two arguments explicitly. |
|
void Spawn<T0, T1, T2> |
T0 t0, |
Invoke a message handler asynchronously, supplying three arguments explicitly. |
|
void SpawnIterator |
IteratorHandler handler |
Invoke an iterator-based message handler asynchronously that does not take any arguments. |
|
void SpawnIterator<T0> |
T0 t0, |
Invoke an iterator-based message handler asynchronously, supplying a single argument explicitly. |
|
void SpawnIterator<T0, T1> |
T0 t0, |
Invoke an iterator-based message handler asynchronously, supplying two arguments explicitly. |
|
void SpawnIterator<T0, T1, T2> |
T0 t0, |
Invoke an iterator-based message handler asynchronously, supplying three arguments explicitly. |
|
void Activate<T> |
params T[] tasks where T : ITask |
Submits CCR tasks to the dispatcher port for execution. If the task was a receiver orchestration like join or choice, executing it means registering constraints on ports to guard the execution of user code. |
|
void EmptyHandler<T> |
T message |
An empty handler implementation that can be used in a receiver to handle a message without side effects. |
|
Port<DateTime> TimeoutPort |
int milliseconds |
Creates a port to receive a time signal, registers a timeout with the sequencer, supplying the private port. |
|
Port<DateTime> TimeoutPort |
TimeSpan ts |
Creates a port to receive a time signal, registers a timeout with the sequencer, supplying the private port. |
© 2012 Microsoft Corporation. All Rights Reserved.