Skip to main content
Home  ›  Blog

New in 2sxc 7: #10 Create Your Own Custom DataSource for the Visual Query

The Visual Query / Pipeline Designer helps you build a chain of data-preparation actions.

Now what if your data comes from another source? For many things you can use the DnnSqlDataSource - but it won't cover everything. We'll add more DataSources in the future, but if you need anything custom - just create your own.

There are many cases where you would like to create a custom DataSource - for example:

  1.  Maybe you would like to have a FileDataSource which gives you a list of files from a specific folder…
  2. Maybe you want to get an RSS-Feed - just create an RssDataSource
  3.  Or you want to get JSON data - JsonDataSource
  4.  Or you want to help all the people who worked with Ventrian Articles and would like to create a VentrianDataSource where the designer doesn't need to know SQL - similar to our DNN FormAndList DataSource In all these cases, just create your own DataSource.

To help you get started, I've prepared a bunch of stuff for you

#1 A Demo Visual Studio Solution with a Custom DataSource

The entire solution is on GitHub here: https://github.com/2sic/eav-Custom-DataSource. Just download or fork or whatever. It contains:

  1.  A DateTimeDataSource demonstrating all kinds of features and best practices  
  2. A Unit-Testing project to test the code We strongly recommend that you use unit testing with all DataSources (we do too) because otherwise testing just takes too long in a live web.
  3. Hint: in Visual Studio - press "Ctrl+R, A" to quickly run all the unit tests automatically

#2 A App containing Demos and Configuration

This can be found here: http://2sxc.org/en/Apps/Details?AppGuid=3bbc0160-a366-49db-99a0-0d50932e8fba

It contains:

  1. Some intro-help text
  2. Some demo queries using the DateTimeDataSource
  3. A content-type called "|Config MyCompany.DataSources.DateTimeDataSource" which the visual Query Designer opens when you want to configure your custom DataSources.

Have fun!

With love from Switzerland,
Daniel 


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