The ModuleDataSource is the standard data source for all modules - and can be replaced. By default it's in charge of giving the View/Template all the content-Items which the editor had added manually through the normal content-editing dialogs.
When you want to work with more data, you may end up replacing this data source with another one from a visual Query, yet there are also many cases where you want both the ModuleDataSource and other data sources as well - so it's helpful to understand what it does.
This is what it looks like in the Visual Query Designer
Streams in the ModuleDataSource
- It expects a "Default" in from which it can retrieve all items. By default this is the Default-Out of a Published-DataSource, so that it shows published/unpublished data based on the user-edit permissions
- Out - it provides 2 standard Out-streams with some specials
- Default - containing the normal module content
- ListContent - containing the header-content, if the module has this
Configuration of the ModuleDataSource
- At the moment (Version 07.00.00) there are no configurable settings in the Visual Query Designer
- If you are using this in razor code, you can specify an alternate ModuleId to access the content assigned to a different module. This is a very special use case so this in currently not enabled in the Visual Query Designer.
Specials of the ModuleDataSource
If a template is configured to deliver data and presentation information, then this presentation information is attached to the Content and the ListContent items leaving the Out-stream. You can then access this presentation information as [Content:Presentation:PresentationAttribute] or @Content.Presentation.PresentationAttribute.
[todo: document more later]
Special Use Case 1: Using Module-Content to Configure a Query
A very common use case for module data is to use it to modify a query. For example, you may develop an App which shows an Events from an existing DNN-Module and you want to give the content-editor the ability to choose which event-module should be used as the source.
In this case you would create a field like EventModuleId in your Content-item and then want to use this in our Query. This can be done easily thanks to the In-Token in data-sources. This is explained in more detail in the feature In TokenProvider for DataSource Configuration.