Skip to main content
Home  ›  Blog

Dynamic DataSources in 2sxc 16 LTS

It is now easy to create custom DataSources and distribute them with your Apps, thanks to Dynamic DataSources, which are just C# code files in your App folder. 

TL;DR - Watch the Video

The samples in the video are in our live tutorials. This is what a lightweight DataSource can look like:

Background: What's a DataSource

Every Razor and WebApi in 2sxc works with data, often with the Content or Data objects. Internally the data is provided from DataSources and Queries (which are also DataSources). 

Every DataSource has one or more Out-Streams providing data - such as a Paging DataSource, which provides all the items of the current page on the stream Default and paging information (page size, amounts of pages etc.) on the Paging stream. 

DataSources can also have one or many In-Streams. The Paging DataSource will take a stream of data (eg. all the items in a blog) and split them into many pages. 

2sxc comes with about 30 built-in DataSources, but there's always the need for more. For example, we have custom SharePoint DataSources which retrieve documents or search-results from SharePoint.

Previously: Compiled DataSources

Up until now all DataSources had to be developed and compiled into a DLL which was very sophisticated and could not be distributed with the App directly. This was fine for enterprise scenarios (eg. the SharePoint DataSource) but intimidating for developers who just wanted to provide some weather data in a DataSource. 

New: Dynamic DataSources

The new DataSources:

  1. have a massively simplified API
  2. are just code files like MyDataSource.cs in the App folder
  3. are included when exporting/importing an App
  4. can be used in Razor, WebApis as well as VisualQueries
  5. have a lot of live tutorials to see them in action and use as inspiration
  6. have a lot of documentation!

Dynamic DataSources Live

We've created extensive docs and more than 25 samples in our live tutorial, which you should check out right away!

May the 4th be with you, 

Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see github), an open source module for creating attractive content and DNN Apps.

Read more posts by Daniel Mettler