Data Sources Tutorial - Use in C# Code
DataSources are the magic backbone of 2sxc. They can get data, filter it, sort it, and more. These samples show you how to use them in code (instead of in VisualQuery).
-
You can use the IDataService with
Kit.Data
in your C# code to get DataSource Objects. A common scenario is when you need to configure the parameters in ways that are not possible in the UI. - Such DataSources can also be linked together (attached) so the output of one DataSource becomes the input of another.
-
You can also provide
options
to give each DataSource it's configuration.
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; <!-- unimportant stuff, hidden --> <h2>Data Sources Tutorial - Use in C# Code</h2> <div @Sys.PageParts.InfoWrapper()> @Html.Partial("../shared/DefaultInfoSection.cshtml") <div @Sys.PageParts.InfoIntro()> <p> <strong>DataSources</strong> are the magic backbone of 2sxc. They can get data, filter it, sort it, and more. These samples show you how to use them in code (instead of in VisualQuery). </p> <ul> <li> You can use the IDataService with <code>Kit.Data</code> in your C# code to get DataSource Objects. A common scenario is when you need to configure the parameters in ways that are not possible in the UI. </li> <li> Such DataSources can also be linked together (<em>attached</em>) so the output of one DataSource becomes the input of another. </li> <li> You can also provide <code>options</code> to give each DataSource it's configuration. </li> </ul> </div> </div> @* Footer *@ @Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })