Custom Dynamic DataSources - Get Data from Other DataSources
Requirements
DataSources can also get other DataSources. For example, a DataSource could get data from the App directly to process them.
Retrieve all the Authors
The Authors
DataSource demonstrates how to get all App data
and then filter it using an inner EntityTypeFilter
DataSource.
Items in the DataSource (6)
- Douglas
- Terry
- Neil
- George
- Raphael
- Ed
Source Code of this file
Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials. Click to expand the code
@inherits Custom.Hybrid.Razor14 @using ToSic.Razor.Blade; @using System.Linq; @using ToSic.Eav.DataSources; <!-- unimportant stuff, hidden --> <h2>Custom Dynamic DataSources - Get Data from Other DataSources</h2> <div @Sys.PageParts.InfoWrapper()> @Html.Partial("../shared/DefaultInfoSection.cshtml") <div @Sys.PageParts.InfoIntro()> <p> DataSources can also get other DataSources. For example, a DataSource could get data from the App directly to process them. </p> </div> </div> Retrieve all the Authors The Authors... <!-- unimportant stuff, hidden --> @{ // Create the Dynamic DataSource with the name "Basic101" var authors = Kit.Data.GetSource(name: "Authors"); } <h3>Items in the DataSource (@authors.List.Count())</h3> <ul> @foreach (var item in AsList(authors)) { <li> <strong>@item.EntityTitle</strong> </li> } </ul> @* Footer *@ @Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })