Table of Contents

Breaking Changes in EAV and 2sxc v20

Breaking Changes in EAV and 2sxc v20 - Moment-of-Truth

Important

2sxc v20 is a milestone clean-up release, so it contains a lot of breaking changes.

This is the Moment of Truth where you see if you accidentally used internal or very old APIs.

These changes should only affect you, if you are accessing exotic/internal APIs, or if you have some extremely old/deprecated code.

See also: MoT Policy (Moment of Truth)

Note that we marked the breaking changes like this

  • ⚠️ things which may affect you
  • ⬇️ things which are extremely unlikely to affect you
Tip

Note that the focus of breaking changes is on the Razor code. But there are also 2 small breaking changes in Formulas.

Highlights

Tip

Despite this being a breaking change, we want to emphasize that much of this is great news. It removes a lot of old cruft, and cleans up some history such as "SexyContent".

These changes only affect you, if you were doing some really nasty things, such as accessing the DB directly.

  1. ⚠️ All SQL tables and restructured - see 2sxc & EAV Database Changes in v20

  2. ⚠️ In Dnn, the module is now installed in /DesktopModules/ToSic.Sxc/ instead of /DesktopModules/ToSic_SexyContent/
    This could affect you, if you had direct links to

  3. ⚠️ In Dnn we stop auto-creating a web.config file in the /2sxc/ folder, so Razor files will no longer automatically use the old base class SexyContentWebPage. This should not affect you, you're installing old Apps in newer DNNs.
    🔨 see Fix Breaking Change Stop Razor from Default to SexyContentWebPage in v20

  4. ⬇️ The minimum Dnn version for v20 is now Dnn 9.11.02 (previously it was 9.6.1)
    This is because older DNNs have important security issues, and we want to force people to update.
    As of now, 2sxc v20 will still run on older DNNs, but we will not support it or test it.

  5. ⬇️ The image resizer only includes the 64 bit binaries, the 32 bit binaries were removed. This makes the distribution smaller, and I don't think anyone is using 32 bit servers anymore.

  6. ⬇️ All code was restructured to create smaller, more focused assemblies.
    This should not affect you, but if you were using some very old code, it may have been moved to a different assembly. This can affect you if you were using compiled code which referenced the old assemblies (not common).

  7. ⬇️ Most internal APIs were moved into Sys namespaces, so it's easier to see if you're using internal APIs.
    This should not affect you, unless you were already using internal APIs.

  8. ⬇️ In Dnn, the modules name is now 2sxc instead of SexyContent

Breaking IEntity API Changes (Razor)

Tip

If your code just used the normal DynamicEntity or TypedEntity / Items APIs, you are not affected by these changes.

But in rare cases, especially in older Apps, some workarounds were used to access the IEntity interface directly.

This is usually done by first running AsEntity(someObject) to get the IEntity underlying data.

  1. ⚠️ A very old interface ToSic.Eav.Interfaces.IEntity has been removed, please use ToSic.Eav.Data.IEntity instead.
    Some very old code may have used this to work around LINQ limitations. Just use the new one, it's the same thing (but with fewer APIs, according to clean-up below).
    We've added some error handling to find out if this is the problem you have, and should lead you to this page.

  2. ⚠️ IEntity has object Get(name, ...) and 2 special Get<TVal>(...) methods to get a value and convert it to string, int etc. The special typed <TVal> variants were moved into extension methods.
    Normally this should not affect you, if you are @using ToSic.Eav.Data in your code, since it will just work. If you did this is a more exotic way, add the @using ToSic.Eav.Data to your code, and it will work again.

  3. ⚠️ IEntity had various GetBestValue(...) APIs which were removed. We believe that about 2-3% of all code used this, so it may affect you. 🔨 see Fix Breaking Change drop old GetBestValue API in v20

  4. ⬇️ APIs on IEntity were modified

    1. .Children(...) and .Parents(...) now return IEnumerable<IEntity> instead of List<IEntity>.
      This will only affect you if you are using .Count on the result, in which case you should use .Count() instead.
  5. ⬇️ Old, deprecated APIs IEntity were removed.
    These have not worked properly for many years.
    We've added some error handling to find out if this is the problem you have, and should lead you to this page.

    1. object GetBestValue(string attributeName, bool resolveHyperlinks) - didn't work for a long time, is being removed

    2. TVal GetBestValue<TVal>(string name, string[] languages, bool resolveHyperlinks) - didn't work for a long time, is being removed

    3. object GetBestValue(string attributeName, string[] languages, bool resolveHyperlinks) - didn't work for a long time, is being removed

    4. object Value(string field, bool resolve = true) - didn't work for a long time, is being removed

    5. T Value<T>(string field, bool resolve = true) - didn't work for a long time, is being removed

  6. ⬇️ Some unofficial APIs on IEntity were removed

    1. object PrimaryValue(string attributeName)
      The term PrimaryValue was an idea which we never pursued further. please just use Get(...) instead

    2. TVal PrimaryValue<TVal>(string attributeName)
      The term PrimaryValue was an idea which we never pursued further. please just use Get(...) instead

    3. object Value(string attributeName)
      The term Value was an idea which we never pursued further. please just use Get(...) instead

    4. TVal Value<TVal>(string attributeName)
      The term Value was an idea which we never pursued further. please just use Get(...) instead

  7. ⬇️ An API giving access to the ContentType Description IContentType.Metadata.Description were removed We don't believe anyone used this.

Other Breaking Razor API Changes (Dnn only)

  1. ⚠️ The behavior to auto-load jQuery for very old Razor base classes was removed.
    A long time ago 2sxc accidentally loaded jQuery automatically in DNN.
    In those days, jQuery was used a lot. We stopped doing this for newer Razor base classes, but preserved the behavior for very old Razor base classes.
    This was removed in v20, so if you were using the old Razor base classes, you will need to add jQuery manually.
    Note: code for this was commented out with #RemovedV20 #OldDnnAutoJQuery.

  2. ⚠️ Three old APIs on old Razor Base classes such as SexyContentWebPage were removed. All have been deprecated since v12.
    They were originally meant to use the same Razor file to also create a WebApi and fill the DNN search index, but was deprecated a long time ago.

    1. Purpose - this was meant to tell Razor if it should prepare data for search or for view.
    2. CustomizeSearch(...) this was meant to customize the data for the search index. The functionality was moved to separate code many years ago.
    3. CustomizeData(...) this was a patchy way to specify the data for the razor template.
  3. ⚠️ The SexyContentWebPage had a List property which provided Element objects to loop through.
    They were deprecated since v12, and replaced with the new Razor base classes which are much better. If you were using these, please switch to the new Razor base classes and use the more modern approaches such as MyItem, MyItem.Presentation, Content, etc. 🔨 To fix, see Fix Breaking Change List of Elements in v20. Note: code for this was commented out with #RemovedV20 #Element.

  4. ⬇️ There is a /system folder in the DesktopModules which had extensions. Each could have a .data folder - this must now be App_Data.
    This is probably not an issue, as we will auto-rename this during the upgrade of v20.00.01

  5. ⚠️ Every App can have a similar /system folder. Each could have a .data folder - this must now be App_Data.
    This is rarely used, but you would have to manually rename this folder to App_Data if you had it.

  6. ⚠️ DNN had some very old (pre v8) WebApi routes like app-content, app-query and app-api which were removed.
    If you had these in your code, please use the same route, just without the app- prefix.

  7. ⬇️ An old interface ToSic.Sxc.Blocks.IRenderService was removed, since it's been superseded by ToSic.Sxc.Services.IRenderService. We believe it was used in 2-3 v12 Apps, so if you encounter this, just switch to ToSic.Sxc.Services.IRenderService instead.

  8. ⬇️ An internal interface called ToSic.Sxc.Data.IEntityLight was removed
    We don't believe anyone used this, but if you did, please use ToSic.Eav.Data.IEntity instead.

  9. ⬇️ A very old interface called SexyContent.Interfaces.IDynamicEntity was removed.
    If you really had this in your code, please use ToSic.Sxc.Data.IDynamicEntity instead.

  10. ⬇️ Some internal objects were consolidated, such as IAttributeBase which nobody should have used anyway
    We don't believe anyone used this.

  11. ⬇️ lots of internal namespaces and classes/interfaces were renamed, including but not limited to:

    1. DynamicEntity.GetEntityValue(string name) (removed)
  12. ⬇️ An old API used by some of the first Mobius Apps used App.Data.Cache.GetContentType.
    This has been obsolete since v10 and is now removed in v20.
    We suggest you use a newer Mobius App or if you're really desperate, see 🔨 Fix Breaking Change Removal of Cache on IAppData in v20.

  13. ⬇️ An old internal interface called ToSic.SexyContent.IAppAndDataHelpers was removed.
    It was implemented by ToSic.SexyContent.Razor.SexyContentWebPage and ToSic.SexyContent.WebApi.SxcApiController. The APIs on it still work, but the interface was removed; you should not notice the clean-up. See Fix Breaking Change Dnn Files / Folders in v20

Breaking Formulas API Changes

V1 form.runFormulas() Was Removed

The V1 formulas were not async, so they had a patchy solution for using formulas which requested data from the server. The old solution was to use fetch and in the promise, call form.runFormulas() to retrigger the formulas after the data was loaded.

2sxc 16 in early 2023 introduced V2 formulas which can return a promise. This will automatically trigger recalculations when the promise resolves, and allows for better control over what happens (like if the same formula should run again, or not).

Since v16 was released, any use of the old form.runFormulas() resulted in a warning in the console.

In v20, this method was disabled showing a JS error. If you were using it, please remove it and use the new V2 formulas instead.

Internal Formula Changes

An internal API which placed some experimental commands in the formula calls were moved to the context. Since it was only used internally, it should not affect anyone.

Other Changes

  1. ⬇️ Custom extensions (such as custom input fields) in the /system folder should place their data in the /system/[ext-name]/App_Data/system-custom/ path.
    Previously the path /system/[ext-name]/.data/ was also supported, but this is now removed.

  2. ⬇️ All system queries which are called System.Whatever previously also supported being called by Eav.Queries.Global.Whatever.
    This is now removed, so you should only use System.Whatever to call global queries.

  3. ⬇️ The DependenciesClass was previously called MyServices but it was very unclear, so it was renamed. ToSic.Eav.Data.IEntity.
    This is a breaking change, but we don't believe anyone used this interface directly, except in custom DataSources - where we kept the old name for compatibility.

  4. ⬇️ The IContentType had a .ContentTypeId which should only be .Id. The old .ContentTypeId was removed (deprecated since v13).
    This is a breaking change, but we don't believe anyone used this property directly.

  5. ⬇️ The IContentType had a .StaticName which should only be .NameId. The old .StaticName was removed (deprecated since v13).
    This is a breaking change, but we don't believe anyone used this property directly.

  6. ⬇️ Previously the APIs .Child(...), .Parent(...), .Children(...), and .Parents(...) on ITypedItem would return the related data without checking for publishing. Now it will check for publishing and only show draft children/parents to editors (v20.00.03).
    This is a breaking change, but we don't believe draft-children were used much.

  7. ⬇️ The ITypedItem had a .Dyn property which was removed (v20.00.04).
    It was a temporary addition (and always marked as such) thought to help in migrating code. But we're afraid people may use it and leave it in, so we decided it's best to completely remove it.

  8. ⬇️ The IApp.ConfigurationProvider has been deprecated since v14 and has been removed (v20.00.07).