DataSource API: Root DataSources which Introduce Data
If your DataSource creates new items - like from memory or elsewhere - it's called a Root DataSource.
Examples would be DataSources which...
- ...get data from a WebApi
- ...list files in a Folder
- ...reads image file properties
Recommendations
- Inherit from the CustomDataSource base class
- Use
ProvideOut
and give it a lambda or method which returns the data either as...- Anonymous objects
- RawEntity objects
- If applicable, also use the
options
onProvideOut(..., options: ...)
to customize how the data is converted to IEntities. - Mark your sources in the VisualQuery Attribute as
DataSourceType.Source
Read Also
- Check out the Dynamic DataSources Tutorials for some easy examples
- Check out some DataSources in 2sxc which do this, such as the Sites DataSource
History
- Introduced ca. EAV / 2sxc v6