Table of Contents

Guide Create Custom DataSources

you are here (click to zoom) - discover the stack

There is a lot of information about DataSources, but some of it is outdated, and some of it is hard to understand. This guide will help you get started and find the right information.

Start with an Overview

Before you even start it's best to have an overview. The 2sxc 16 Dynamic DataSources Release Video is a good place to start.

Step 1: Experience Live Code

Before you read anything else in these docs, you must look at the live tutorials. This will help you understand what's actually going on. The remaining documentation assumes you have seen these tutorials.

🚀 first you must review the live samples in our Dynamic DataSources Tutorials

Step 2: Review your Understanding

Once you have seen the live code, you should have a basic idea of:

  1. What a Custom DataSource is
  2. What Data Streams are, and how they are provided using ProvideOut
  3. How DataSources are made configurable using [Configuration] and how they read the configuration using Configuration.GetThis() and Configuration.GetThis<T>()
  4. Use in Razor/WebApi C# Code
    1. How code will create such a DataSource using Kit.Data.GetSource
    2. How code can connect DataSources using attach
    3. How code can pass in configuration using parameters:
  5. Use in Visual Query
    1. How DataSources appear in VisualQuery
    2. How they can be configured using the ContentType
Tip

The above list of things you should understand is important. Make sure you can say yes to each point mentioned above, otherwise go back and review the live tutorials.

Step 3: Learn the Big Picture

💡 You should read through the Big Picture of DataSources

Step 4: Create your first Dynamic DataSources

Now that you have seen the live tutorials, you should create a few Dynamic DataSources. You should not start with Compiled DataSources. They are much more difficult, and each failed try requires a rebuild, redeploy and restart of the website - with takes a long time.

Step 4: Deepen your Understanding

If you got this far and would like to go even deeper, this is what you probably need:

  1. how to provide data in different streams and different data types
  2. how to build entities with different property types and relationships as well as RawEntity objects
  3. advanced configuration possibilities
  4. use data from In streams, both the Default as well as other streams
  5. error handling

Step 5: Create Compiled DataSources (optional)

Only do this if you really need to, because it's much more complex and requires a lot of knowledge about the internals of the EAV.

The guide stops here, but you can continue on Compiled DataSources.

History

  1. Introduced in 2sxc ca. 4 but with a difficult API
  2. API strongly enhanced and simplifield in 2sxc 09.13
  3. Another API rework ca. 2sxc 10.25 (but we're not exactly sure)
  4. Major breaking API changes and improvements in 2sxc 15
  5. Dynamic DataSources introduced in 2sxc 16