DataSource API: Out Streams
All DataSources must have Out Streams.
By convention, the primary Out is called Default
and the VisualQuery Designer assumes that it exists by default.
But there are two important things you can change
- You can determine one or more predefined Out streams
- You can tell the UI that your Stream can have many, dynamically named Out-Streams just like the App DataSource
Important
Here we only explain aspects which are relevant to your code. Make sure you are familiar with the general concept of Out-Streams.
Pre-Named Out-Streams
For an example, we'll use the Paging DataSource.
It's job is to take a list of items and only forward a chunk on the Default
, like "Page 3 containing items 61-90".
In addition it should also provide information as to what page we're on and how many pages exist.
This is defined in the constructor, where the DataSource determines what it Provides #todoc.
public Paging()
{
ProvideOut(GetList);
ProvideOut(GetPaging, "Paging");
}
The two lines of ProvideOut
are the important bits:
ProvideOut(GetList)
will provide data on theDefault
Out-StreamProvideOut(GetPaging, "Paging")
will provide data on thePaging
Out-Stream
Dynamic Out Streams
Some DataSources like the App DataSource can have many Out-streams which are not known till Runtime. To allow the UI to provide these, we must specify this in the VisualQuery attribute. Here's an example of the App DataSource:
[VisualQuery(
NameId = "...",
Type = DataSourceType.Source,
Icon = "app",
DynamicOut = true,
NiceName = "App",
UiHint = "...",
ConfigurationType = "...",
HelpLink = "...")]
The important part here is the DynamicOut = true
.
Strategies for Providing Dynamic Out
Providing dynamic-out in your code can be tricky, and there are 2 strategies you can use:
- Create all Out-Streams on first Use of
Out
This would create the Out-Accessors whenOut
is first accessed. You can see examples of this on the App DataSource - Re-Implement the
Out
of the typeIDictionary<string, IDataStream>
to do some kind of Lazy-Loading There is no example to do this, but it could be done.
Note that this is fairly sophisticated so do spend some time to familiarize yourself with the EAV code before you attempt this.
History
- Introduced ca. in 2sxc 6
- Extended with Dynamic Out ca. 2sxc 8
- Provide API completely changed in v15+ and uses the new
ProvideOut
method