Skip to content

Commit

Permalink
Merge pull request #3558 from 2sic/develop
Browse files Browse the repository at this point in the history
v19.03 LTS
  • Loading branch information
iJungleboy authored Jan 22, 2025
2 parents 1eafc34 + 3a3f459 commit 7b4e469
Show file tree
Hide file tree
Showing 53 changed files with 359 additions and 266 deletions.
1 change: 0 additions & 1 deletion Src/Dnn/ToSic.Sxc.Dnn.Razor/Custom/Hybrid/RazorTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using ToSic.Sxc.Code.Internal.CodeErrorHelp;
using ToSic.Sxc.Code.Internal.CodeRunHelpers;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Dnn.Razor;
using ToSic.Sxc.Dnn.Razor.Internal;
using ToSic.Sxc.Engines;
Expand Down
1 change: 0 additions & 1 deletion Src/Dnn/ToSic.Sxc.Dnn.WebApi/Custom/Hybrid/ApiTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using ToSic.Sxc.Adam;
using ToSic.Sxc.Code.Internal;
using ToSic.Sxc.Code.Internal.CodeRunHelpers;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Dnn.WebApi.Internal.Compatibility;
using ToSic.Sxc.Internal;

Expand Down
2 changes: 1 addition & 1 deletion Src/Dnn/ToSic.Sxc.Dnn/DnnPackageBuilder/ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<dl>
<dt>v19.02.00</dt>
<dt>v19.03.00</dt>
<dd>Part of module installation is the deletion of unneeded data. In an infrequent case, You could get a
timeout exception. This is not a show-stopper. Simply reload the page so DNN can continue clean-up
until all unnecessary data is deleted and the module is installed.</dd>
Expand Down
8 changes: 4 additions & 4 deletions Src/Dnn/ToSic.Sxc.Dnn/DnnPackageBuilder/ToSic.Sxc.Dnn.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="2SexyContent" type="Module" version="19.02.00">
<package name="2SexyContent" type="Module" version="19.03.00">
<friendlyName> Content</friendlyName>
<description>2sxc is a DNN Extension to create attractive and designed content. It solves the common problem, allowing the web designer to create designed templates for different content elements, so that the user must only fill in fields and receive a perfectly designed and animated output.</description>
<iconFile>icon.png</iconFile>
Expand Down Expand Up @@ -79,7 +79,7 @@
<script type="UnInstall">
<path>SqlDataProvider</path>
<name>Uninstall.SqlDataProvider</name>
<version>19.02.00</version>
<version>19.03.00</version>
</script>
</scripts>
</component>
Expand Down Expand Up @@ -130,7 +130,7 @@
<businessControllerClass>ToSic.SexyContent.DnnBusinessController</businessControllerClass>
<desktopModuleID>[DESKTOPMODULEID]</desktopModuleID>
<!-- This must contain all versions which have upgrade-code. By convention, we also add the main entry versions, even if no upgrade code exists for them -->
<upgradeVersionsList>01.00.00,08.11.00,08.12.00,09.00.00,10.00.00,11.00.00,12.00.00,13.00.00,13.01.00,13.04.00,14.00.00,15.00.00,15.02.00,16.00.00,16.07.01,17.00.00,18.00.00,18.03.00,19.00.00,19.02.00</upgradeVersionsList>
<upgradeVersionsList>01.00.00,08.11.00,08.12.00,09.00.00,10.00.00,11.00.00,12.00.00,13.00.00,13.01.00,13.04.00,14.00.00,15.00.00,15.02.00,16.00.00,16.07.01,17.00.00,18.00.00,18.03.00,19.00.00,19.03.00</upgradeVersionsList>
</attributes>
</eventMessage>
</component>
Expand Down Expand Up @@ -642,7 +642,7 @@
</components>
</package>

<package name="2SexyContent-App" type="Module" version="19.02.00">
<package name="2SexyContent-App" type="Module" version="19.03.00">
<friendlyName> App</friendlyName>
<description>2sxc App is an extension that allows to install and use a 2sxc app.</description>
<iconFile>icon-app.png</iconFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package>
<metadata>
<id>ToSic.Sxc.Oqtane.Install</id>
<version>19.02.00</version>
<version>19.03.00</version>
<authors>2sic internet solutions GmbH, Switzerland</authors>
<owners>2sic internet solutions GmbH, Switzerland</owners>
<title>2sxc CMS and Meta-Module for Oqtane</title>
Expand Down
1 change: 0 additions & 1 deletion Src/Oqtane/ToSic.Sxc.Oqt.Server/Custom/Hybrid/ApiTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using ToSic.Lib.Coding;
using ToSic.Sxc.Code.Internal;
using ToSic.Sxc.Code.Internal.CodeRunHelpers;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Internal;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using ToSic.Sxc.Code.Internal.CodeRunHelpers;
using ToSic.Sxc.Context;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Engines;
using ToSic.Sxc.Internal;
using ToSic.Sxc.Razor.Internal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
using System;
using System.Collections.Generic;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Internal;

namespace ToSic.Sxc.Tests.DataTests.ModelTests;

internal static class DataModelAnalyzerTestAccessors
{
public static string GetContentTypeNameTac<T>()
//public static string GetContentTypeNameTac<T>()
// where T : class, ICanWrapData
//=> DataModelAnalyzer.GetContentTypeNameCsv<T>();
public static (List<string> List, string Flat) GetContentTypeNamesTac<T>()
where T : class, ICanWrapData
=> DataModelAnalyzer.GetContentTypeNames<T>();
=> DataModelAnalyzer.GetContentTypeNamesList<T>();

public static string GetStreamNameTac<T>()
public static (List<string> List, string Flat) GetStreamNameListTac<T>()
where T : class, ICanWrapData
=> DataModelAnalyzer.GetStreamName<T>();
=> DataModelAnalyzer.GetStreamNameList<T>();

public static Type GetTargetTypeTac<T>()
where T : class, ICanWrapData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Data.Models;

namespace ToSic.Sxc.Tests.DataTests.ModelTests;

Expand All @@ -9,10 +9,11 @@ public class DataModelAnalyzerTests : TestBaseSxcDb
{
private void AssertTypeName<T>(string name)
where T : class, ICanWrapData =>
Assert.AreEqual(name, DataModelAnalyzerTestAccessors.GetContentTypeNameTac<T>());
private void AssertStreamName<T>(string name)
Assert.AreEqual(name, DataModelAnalyzerTestAccessors.GetContentTypeNamesTac<T>().Flat);

private void AssertStreamNames<T>(string namesCsv)
where T : class, ICanWrapData =>
Assert.AreEqual(name, DataModelAnalyzerTestAccessors.GetStreamNameTac<T>());
Assert.AreEqual(namesCsv, DataModelAnalyzerTestAccessors.GetStreamNameListTac<T>().Flat);

class NotDecorated: ICanWrapData;

Expand All @@ -22,23 +23,39 @@ public void NotDecoratedDataModelType() =>

[TestMethod]
public void NotDecoratedDataModelStream() =>
AssertStreamName<NotDecorated>(nameof(NotDecorated));
AssertStreamNames<NotDecorated>(nameof(NotDecorated));

[TestMethod]
public void NotDecoratedDataModelStreamList() =>
AssertStreamNames<NotDecorated>(nameof(NotDecorated));

class NotDecoratedModel : ICanWrapData;

[TestMethod]
public void NotDecoratedModelStreamList() =>
AssertStreamNames<NotDecoratedModel>(nameof(NotDecoratedModel) + "," + nameof(NotDecorated));

// Objects starting with an "I" won't have the "I" removed in the name checks
class INotDecoratedModel : ICanWrapData;

[TestMethod]
public void INotDecoratedModelStreamList() =>
AssertStreamNames<INotDecoratedModel>(nameof(INotDecoratedModel) + ",INotDecorated");

interface INotDecorated: ICanWrapData;

[TestMethod]
public void INotDecoratedType() =>
AssertTypeName<INotDecorated>(nameof(INotDecorated).Substring(1));
AssertTypeName<INotDecorated>(nameof(INotDecorated) + ',' + nameof(INotDecorated).Substring(1));

[TestMethod]
public void INotDecoratedStream() =>
AssertStreamName<INotDecorated>(nameof(INotDecorated));
AssertStreamNames<INotDecorated>(nameof(INotDecorated) + ",NotDecorated");


private const string ForContentType1 = "Abc";
private const string StreamName1 = "AbcStream";
[DataModel(ForContentTypes = ForContentType1, StreamNames = StreamName1)]
[ModelSource(ContentTypes = ForContentType1, Streams = StreamName1)]
class Decorated: ICanWrapData;

[TestMethod]
Expand All @@ -47,7 +64,7 @@ public void DecoratedType() =>

[TestMethod]
public void DecoratedStream() =>
AssertStreamName<Decorated>(StreamName1);
AssertStreamNames<Decorated>(StreamName1);


class InheritDecorated : Decorated;
Expand All @@ -58,25 +75,25 @@ public void InheritDecoratedType() =>

[TestMethod]
public void InheritDecoratedStream() =>
AssertStreamName<InheritDecorated>(nameof(InheritDecorated));
AssertStreamNames<InheritDecorated>(nameof(InheritDecorated));


private const string ForContentTypeReDecorated = "ReDec";
private const string StreamNameReDecorated = "ReDecStream";
[DataModel(ForContentTypes = ForContentTypeReDecorated, StreamNames = StreamNameReDecorated + ",Abc")]
[ModelSource(ContentTypes = ForContentTypeReDecorated, Streams = StreamNameReDecorated + ",Abc")]
class InheritReDecorated : InheritDecorated;

[TestMethod]
public void InheritReDecoratedType() =>
AssertTypeName<InheritReDecorated>(ForContentTypeReDecorated);
[TestMethod]
public void InheritReDecoratedStream() =>
AssertStreamName<InheritReDecorated>(StreamNameReDecorated);
AssertStreamNames<InheritReDecorated>(StreamNameReDecorated + ",Abc");


private const string ForContentTypeIDecorated = "IDec";
private const string StreamNameIDecorated= "IRedecStream";
[DataModel(ForContentTypes = ForContentTypeIDecorated, StreamNames = StreamNameIDecorated)]
[ModelSource(ContentTypes = ForContentTypeIDecorated, Streams = StreamNameIDecorated)]
interface IDecorated: ICanWrapData;

[TestMethod]
Expand All @@ -85,6 +102,6 @@ public void IDecoratedType() =>

[TestMethod]
public void IDecoratedStream() =>
AssertStreamName<IDecorated>(StreamNameIDecorated);
AssertStreamNames<IDecorated>(StreamNameIDecorated);

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ToSic.Eav.Data;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Data.Models;

namespace ToSic.Sxc.Tests.DataTests.ModelTests;

Expand Down Expand Up @@ -36,8 +36,8 @@ public void INotDecoratedType() =>

#region Decorated - should return the decorated type

[DataModelConversion(Map = [typeof(DataModelFrom<IEntity, Decorated, DecoratedEntity>)])]
class Decorated: DataModel;
[ModelCreation(Use = typeof(DecoratedEntity))]
class Decorated: ModelFromEntity;

class DecoratedEntity : Decorated;

Expand All @@ -60,7 +60,7 @@ public void InheritDecoratedType() =>

#region Inherit and redecorate, should return the newly decorated type

[DataModelConversion(Map = [typeof(DataModelFrom<IEntity, InheritReDecorated, InheritReDecoratedEntity>)])]
[ModelCreation(Use = typeof(InheritReDecoratedEntity))]
class InheritReDecorated : InheritDecorated;

class InheritReDecoratedEntity : InheritReDecorated;
Expand All @@ -73,7 +73,7 @@ public void InheritReDecoratedType() =>

#region Interface decorated - should return the decorated type

[DataModelConversion(Map = [typeof(DataModelFrom<IEntity, IDecorated, EntityOfIDecorated>)])]
[ModelCreation(Use = typeof(EntityOfIDecorated))]
interface IDecorated : ICanWrapData;

class EntityOfIDecorated : InheritReDecorated, IDecorated;
Expand Down
7 changes: 3 additions & 4 deletions Src/Sxc/ToSic.Sxc/Apps/IAppDataTyped.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using ToSic.Eav.DataSource;
using ToSic.Eav.Metadata;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;

namespace ToSic.Sxc.Apps;

Expand Down Expand Up @@ -65,7 +64,7 @@ public interface IAppDataTyped: IDataSource
/// </remarks>
public IEnumerable<T> GetAll<T>(NoParamOrder protector = default, string typeName = default,
bool nullIfNotFound = default)
where T : class, ICanWrapData, new();
where T : class, ICanWrapData;

/// <summary>
/// Get a single item from the app of the specified type.
Expand All @@ -79,7 +78,7 @@ public IEnumerable<T> GetAll<T>(NoParamOrder protector = default, string typeNam
/// Released in v17.03.
/// </remarks>
T GetOne<T>(int id, NoParamOrder protector = default, bool skipTypeCheck = false)
where T : class, ICanWrapData, new();
where T : class, ICanWrapData;


/// <summary>
Expand All @@ -94,7 +93,7 @@ T GetOne<T>(int id, NoParamOrder protector = default, bool skipTypeCheck = false
/// Released in v17.03.
/// </remarks>
public T GetOne<T>(Guid id, NoParamOrder protector = default, bool skipTypeCheck = false)
where T : class, ICanWrapData, new();
where T : class, ICanWrapData;

#endregion
}
1 change: 0 additions & 1 deletion Src/Sxc/ToSic.Sxc/Apps/IAppTyped_TSettings_TResources.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ToSic.Eav.Apps;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;

namespace ToSic.Sxc.Apps;

Expand Down
26 changes: 24 additions & 2 deletions Src/Sxc/ToSic.Sxc/Apps/Internal/AppDataTyped.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ToSic.Eav.Apps.Internal.Api01;
using ToSic.Eav.DataSource;
using ToSic.Eav.DataSource.Internal.Caching;
using ToSic.Eav.DataSources.Internal;
using ToSic.Lib.DI;
Expand Down Expand Up @@ -42,10 +43,31 @@ private ServiceKit16 Kit
/// <inheritdoc />
IEnumerable<T> IAppDataTyped.GetAll<T>(NoParamOrder protector, string typeName, bool nullIfNotFound)
{
var streamName = typeName ?? DataModelAnalyzer.GetStreamName<T>();
//var streamName = typeName ?? DataModelAnalyzer.GetStreamName<T>();
//var errStreamName = streamName;

var streamNames = typeName == null
? DataModelAnalyzer.GetStreamNameList<T>()
: ([typeName], typeName);

// Get the list - will be null if not found
var list = GetStream(streamName, nullIfNotFound: nullIfNotFound);
IDataStream list = null;
foreach (var streamName2 in streamNames.List)
list ??= GetStream(streamName2, nullIfNotFound: true);


//// If we didn't find it, check if the stream name is *Model and try without that common suffix
//if (list == null && streamName.EndsWith("Model"))
//{
// var shorterName = streamName.Substring(0, streamName.Length - 5);
// errStreamName += "," + shorterName;
// list = GetStream(shorterName, nullIfNotFound: true);
//}

// If we didn't find anything yet, then we must now try to re-access the stream
// but in a way which will throw an exception with the expected stream names
if (list == null && !nullIfNotFound)
list = GetStream(/*errStreamName*/streamNames.Flat, nullIfNotFound: false);

return list == null
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using ToSic.Eav.Internal.Environment;
using ToSic.Lib.DI;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;

namespace ToSic.Sxc.Apps.Internal;

Expand Down
6 changes: 2 additions & 4 deletions Src/Sxc/ToSic.Sxc/Cms/Assets/IFileModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ToSic.Eav.Apps.Assets;
using ToSic.Sxc.Cms.Assets.Internal;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Data.Models;

namespace ToSic.Sxc.Cms.Assets;

Expand All @@ -16,9 +16,7 @@ namespace ToSic.Sxc.Cms.Assets;
/// * This is similar to the <see cref="Adam.IFile"/> but still a bit different.
/// For example, it has a <see cref="Folder"/> property which is different from the <see cref="IFile.Folder"/> property.
/// </remarks>
[DataModelConversion(Map = [
typeof(DataModelFrom<IEntity, IFileModel, FileModelOfEntity>),
])]
[ModelCreation(Use = typeof(FileModelOfEntity))]
[InternalApi_DoNotUse_MayChangeWithoutNotice("Still tweaking details and naming v19.0x")]
public interface IFileModel: ICanWrapData
{
Expand Down
6 changes: 2 additions & 4 deletions Src/Sxc/ToSic.Sxc/Cms/Assets/IFolderModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ToSic.Sxc.Adam;
using ToSic.Sxc.Cms.Assets.Internal;
using ToSic.Sxc.Data;
using ToSic.Sxc.Data.Model;
using ToSic.Sxc.Data.Models;

namespace ToSic.Sxc.Cms.Assets;

Expand All @@ -15,9 +15,7 @@ namespace ToSic.Sxc.Cms.Assets;
/// * Not to be seen as final, since we may rename this type when we also
/// * This is similar to the <see cref="IFolder"/> but still a bit different. For example, it has a <see cref="Folder"/> property.
/// </remarks>
[DataModelConversion(Map = [
typeof(DataModelFrom<IEntity, IFolderModel, FolderModelOfEntity>),
])]
[ModelCreation(Use = typeof(FolderModelOfEntity))]
[InternalApi_DoNotUse_MayChangeWithoutNotice("Still tweaking details and naming v19.0x")]
public interface IFolderModel: ICanWrapData
{
Expand Down
Loading

0 comments on commit 7b4e469

Please sign in to comment.