If a DataSource is configurable, then configuration must parse tokens before accessing the values. This is done with EnsureConfigurationIsLoaded.
This is part of the new API for DataSources released in 2sxc 9.13.
How to use EnsureConfigurationIsLoaded
Here's a simple example of the PublishingFilter DataSources:
EnsureConfigurationIsLoaded in the PublishingFilter
// get the correct stream, depending on ShowDrafts
private IEnumerable<IEntity> GetList()
{
EnsureConfigurationIsLoaded();
Log.Add($"get incl. draft:{ShowDrafts}");
var outStreamName = ShowDrafts
? Constants.DraftsStreamName
: Constants.PublishedStreamName;
return In[outStreamName].List;
}
This example needs ShowDrafts to be boolean (true/false), but the built-in token-template for it is [Settings:ShowDrafts||false]. This is why EnsureConfigurationIsLoaded() must be called first.
Advanced Use Cases
There are more things to discover in advanced scenarios. You can read about it in the Wiki on EnsureConfigurationIsLoaded.
Love from Switzerland,
Daniel