Skip to main content
Home  ›  Blog

Migrating Custom DataSources to 2sxc 10.20

Custom DataSources require changes when you upgrade past 2sxc 10.20, because we refactored some internal APIs for consistency. Here's what you need to do. 

Why the API changed

While creating the docs.2sxc.org site we realised how much history had gotten into the code base. Many internal namespaces and object names were not consistent and we believe that once we publish them as official on the docs, people will use them more. So we wanted to make sure that whatever we do document and publish has a clean, consistend setup. 

We were able to move the stuff around without breaking any razor templates and WebApis, but the DataSource API had some parts which had to be moved in a breaking way.

Important Changes for Custom DataSources

Here the important bits

  1. If your DataSource has a VisualQuery Attribute, you probably need to change this
    1. Switch from
      ToSic.Eav.DataSources.VisualQuery.VisualQueryAttribute
      to
      ToSic.Eav.DataSources.Queries.VisualQueryAttribute
      This switch is optional, because we left an obsolete version of the old Attribute in the code base.
    2. In the attribute you need to switch the Type (which is a DataSourceType.XXX) to the new DataSourceType which is now also in ToSic.Eav.DataSources.Queries.
  2. If you are using PropertyAccess objects, they were all moved into a new namespace:
    ToSic.Eav.LookUp
    and th core objects were also renamed to be LookUpInXXX
  3. You probably have a GetList or similar which returns items of
    Eav.Interfaces.IEntity
    this must be changed to
    Eav.Data.IEntity
    because we decided that we would rather organize interfaces by topic then by the fact that they are interfaces. 
  4. Your code probably inherits from 
    ExternalDataDataSource
    which should be changed to
    ExternalData
    because we dropped the 'DataSource' suffix which had been used inconsistently. 
  5. For the same reason if you're using a DataTableDataSource internally, also rename that to DataTable.
  6. If you were referencing the DLL ToSic.Eav.Tokens this is not necessary any more, all the functionality was transferred to ToSic.Eav.Core which you already reference.

Of course you might also have used other internal Eav or Sxc objects which were never publicly documented. Most of them you'll find in the docs or in your IntelliSense. Please remember that anything not officially documented could still easily change in a future release. 

Example

We updated the sample code for the DnnFormAndList DataSource so you can check it out in the git repo.

With love from Switzerland,
iJungleboy


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