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.
⚠️ All SQL tables and restructured - see 2sxc & EAV Database Changes in v20
⚠️ 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- the
$2sxc.min.js
file in your templates - were using the extremely old image resizer on the path
/DesktopModules/ToSic_SexyContent/Extensions/Thumbnailer.aspx
🔨 see Fix Breaking Change Thumbnailer.aspx in v20 - used one of the recommended base themes such as 2shine and now quick-edit doesn't automatically appear on empty pages.
🔨 see Fix Breaking Change QuickEdit on Empty Page in v20
- the
⚠️ 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 classSexyContentWebPage
. 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⬇️ 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.⬇️ 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.
⬇️ 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).⬇️ 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.⬇️ In Dnn, the modules name is now
2sxc
instead ofSexyContent
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.
⚠️ A very old interface
ToSic.Eav.Interfaces.IEntity
has been removed, please useToSic.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.⚠️
IEntity
hasobject Get(name, ...)
and 2 specialGet<TVal>(...)
methods to get a value and convert it tostring
,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.⚠️
IEntity
had variousGetBestValue(...)
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⬇️ APIs on
IEntity
were modified.Children(...)
and.Parents(...)
now returnIEnumerable<IEntity>
instead ofList<IEntity>
.
This will only affect you if you are using.Count
on the result, in which case you should use.Count()
instead.
⬇️ 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.object GetBestValue(string attributeName, bool resolveHyperlinks)
- didn't work for a long time, is being removedTVal GetBestValue<TVal>(string name, string[] languages, bool resolveHyperlinks)
- didn't work for a long time, is being removedobject GetBestValue(string attributeName, string[] languages, bool resolveHyperlinks)
- didn't work for a long time, is being removedobject Value(string field, bool resolve = true)
- didn't work for a long time, is being removedT Value<T>(string field, bool resolve = true)
- didn't work for a long time, is being removed
⬇️ Some unofficial APIs on
IEntity
were removedobject PrimaryValue(string attributeName)
The termPrimaryValue
was an idea which we never pursued further. please just useGet(...)
insteadTVal PrimaryValue<TVal>(string attributeName)
The termPrimaryValue
was an idea which we never pursued further. please just useGet(...)
insteadobject Value(string attributeName)
The termValue
was an idea which we never pursued further. please just useGet(...)
insteadTVal Value<TVal>(string attributeName)
The termValue
was an idea which we never pursued further. please just useGet(...)
instead
⬇️ 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)
⚠️ 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
.⚠️ 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.Purpose
- this was meant to tell Razor if it should prepare data for search or for view.CustomizeSearch(...)
this was meant to customize the data for the search index. The functionality was moved to separate code many years ago.CustomizeData(...)
this was a patchy way to specify the data for the razor template.
⚠️ The
SexyContentWebPage
had aList
property which providedElement
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 asMyItem
,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
.⬇️ There is a
/system
folder in the DesktopModules which had extensions. Each could have a.data
folder - this must now beApp_Data
.
This is probably not an issue, as we will auto-rename this during the upgrade of v20.00.01⚠️ Every App can have a similar
/system
folder. Each could have a.data
folder - this must now beApp_Data
.
This is rarely used, but you would have to manually rename this folder toApp_Data
if you had it.⚠️ DNN had some very old (pre v8) WebApi routes like
app-content
,app-query
andapp-api
which were removed.
If you had these in your code, please use the same route, just without theapp-
prefix.⬇️ An old interface
ToSic.Sxc.Blocks.IRenderService
was removed, since it's been superseded byToSic.Sxc.Services.IRenderService
. We believe it was used in 2-3 v12 Apps, so if you encounter this, just switch toToSic.Sxc.Services.IRenderService
instead.⬇️ An internal interface called
ToSic.Sxc.Data.IEntityLight
was removed
We don't believe anyone used this, but if you did, please useToSic.Eav.Data.IEntity
instead.⬇️ A very old interface called
SexyContent.Interfaces.IDynamicEntity
was removed.
If you really had this in your code, please useToSic.Sxc.Data.IDynamicEntity
instead.⬇️ Some internal objects were consolidated, such as
IAttributeBase
which nobody should have used anyway
We don't believe anyone used this.⬇️ lots of internal namespaces and classes/interfaces were renamed, including but not limited to:
DynamicEntity.GetEntityValue(string name)
(removed)
⬇️ 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.⬇️ An old internal interface called
ToSic.SexyContent.IAppAndDataHelpers
was removed.
It was implemented byToSic.SexyContent.Razor.SexyContentWebPage
andToSic.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
⬇️ 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.⬇️ All system queries which are called
System.Whatever
previously also supported being called byEav.Queries.Global.Whatever
.
This is now removed, so you should only useSystem.Whatever
to call global queries.⬇️ 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.⬇️ 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.⬇️ 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.⬇️ Previously the APIs
.Child(...)
,.Parent(...)
,.Children(...)
, and.Parents(...)
onITypedItem
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.⬇️ 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.⬇️ The
IApp.ConfigurationProvider
has been deprecated since v14 and has been removed (v20.00.07).