V10: Fix build warnings in core (#12438)
* Run code cleanup * Start manual cleanup after dotnet format * Finish up manual pass * Fix up missed warnings * Fix after merge * Update src/Umbraco.Core/Cache/ContentTypeCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DataTypeCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DeepCloneAppCache.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/DomainCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/FastDictionaryAppCacheBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MacroCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MediaCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MemberCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Cache/MemberGroupCacheRefresher.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/OrderedCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/SetCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/ContentApps/ContentAppFactoryCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Dashboards/DashboardCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DataTypeCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/ContentUnpublishingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DictionaryItemSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/DomainCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/LanguageCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MacroCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaEmptiedRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaEmptyingRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaMovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTreeChangeNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTreeChangeNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeChangedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MediaTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberGroupSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeChangedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeDeletedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeMovingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeRefreshedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MemberTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/StringExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/UriExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovedToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/MovingToRecycleBinNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Extensions/UriExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/PhysicalFileSystem.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/PhysicalFileSystem.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/IO/ShadowWrapper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Logging/DisposableTimer.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Install/InstallSteps/UpgradeStep.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Mapping/MapDefinitionCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Media/EmbedProviders/EmbedProvidersCollectionBuilder.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/ContentEditing/ContentVariationDisplay.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PartialViewSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntryDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/PublicAccessEntrySavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeCacheRefresherNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeSavedNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/RelationTypeSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StatefulNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StylesheetDeletingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Notifications/StylesheetSavingNotification.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/DeepCloneHelper.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/File.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/PropertyGroupExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Update src/Umbraco.Core/Models/PropertyGroupExtensions.cs Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Fix based on review * Fix after merge Signed-off-by: Zeegaan <nge@umbraco.dk> Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
@@ -1,130 +1,126 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models.Blocks
|
||||
namespace Umbraco.Cms.Core.Models.Blocks;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item for the Block List editor.
|
||||
/// </summary>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
[DataContract(Name = "block", Namespace = "")]
|
||||
public class BlockListItem : IBlockReference<IPublishedElement>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a layout item for the Block List editor.
|
||||
/// Initializes a new instance of the <see cref="BlockListItem" /> class.
|
||||
/// </summary>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
[DataContract(Name = "block", Namespace = "")]
|
||||
public class BlockListItem : IBlockReference<IPublishedElement>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// contentUdi
|
||||
/// or
|
||||
/// content
|
||||
/// </exception>
|
||||
public BlockListItem(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings)
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <exception cref="System.ArgumentNullException">contentUdi
|
||||
/// or
|
||||
/// content</exception>
|
||||
public BlockListItem(Udi contentUdi, IPublishedElement content, Udi settingsUdi, IPublishedElement settings)
|
||||
{
|
||||
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
||||
Content = content ?? throw new ArgumentNullException(nameof(content));
|
||||
SettingsUdi = settingsUdi;
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "contentUdi")]
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
[DataMember(Name = "content")]
|
||||
public IPublishedElement Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "settingsUdi")]
|
||||
public Udi SettingsUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
[DataMember(Name = "settings")]
|
||||
public IPublishedElement Settings { get; }
|
||||
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
||||
Content = content ?? throw new ArgumentNullException(nameof(content));
|
||||
SettingsUdi = settingsUdi;
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with a generic content type for the Block List editor.
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the content.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<T> : BlockListItem
|
||||
where T : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, T content, Udi settingsUdi, IPublishedElement settings)
|
||||
: base(contentUdi, content, settingsUdi, settings)
|
||||
{
|
||||
Content = content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
public new T Content { get; }
|
||||
}
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
[DataMember(Name = "content")]
|
||||
public IPublishedElement Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with generic content and settings types for the Block List editor.
|
||||
/// Gets the settings UDI.
|
||||
/// </summary>
|
||||
/// <typeparam name="TContent">The type of the content.</typeparam>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<TContent, TSettings> : BlockListItem<TContent>
|
||||
where TContent : IPublishedElement
|
||||
where TSettings : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{TContent, TSettings}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content udi.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings udi.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, TContent content, Udi settingsUdi, TSettings settings)
|
||||
: base(contentUdi, content, settingsUdi, settings)
|
||||
{
|
||||
Settings = settings;
|
||||
}
|
||||
/// <value>
|
||||
/// The settings UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "settingsUdi")]
|
||||
public Udi SettingsUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
public new TSettings Settings { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
[DataMember(Name = "contentUdi")]
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
[DataMember(Name = "settings")]
|
||||
public IPublishedElement Settings { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with a generic content type for the Block List editor.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the content.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<T> : BlockListItem
|
||||
where T : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{T}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings UDI.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, T content, Udi settingsUdi, IPublishedElement settings)
|
||||
: base(contentUdi, content, settingsUdi, settings) =>
|
||||
Content = content;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content.
|
||||
/// </value>
|
||||
public new T Content { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a layout item with generic content and settings types for the Block List editor.
|
||||
/// </summary>
|
||||
/// <typeparam name="TContent">The type of the content.</typeparam>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <seealso cref="Umbraco.Core.Models.Blocks.IBlockReference{Umbraco.Core.Models.PublishedContent.IPublishedElement}" />
|
||||
public class BlockListItem<TContent, TSettings> : BlockListItem<TContent>
|
||||
where TContent : IPublishedElement
|
||||
where TSettings : IPublishedElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListItem{TContent, TSettings}" /> class.
|
||||
/// </summary>
|
||||
/// <param name="contentUdi">The content udi.</param>
|
||||
/// <param name="content">The content.</param>
|
||||
/// <param name="settingsUdi">The settings udi.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
public BlockListItem(Udi contentUdi, TContent content, Udi settingsUdi, TSettings settings)
|
||||
: base(contentUdi, content, settingsUdi, settings) =>
|
||||
Settings = settings;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
public new TSettings Settings { get; }
|
||||
}
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models.Blocks
|
||||
namespace Umbraco.Cms.Core.Models.Blocks;
|
||||
|
||||
/// <summary>
|
||||
/// The strongly typed model for the Block List editor.
|
||||
/// </summary>
|
||||
/// <seealso cref="ReadOnlyCollection{BlockListItem}" />
|
||||
[DataContract(Name = "blockList", Namespace = "")]
|
||||
public class BlockListModel : ReadOnlyCollection<BlockListItem>
|
||||
{
|
||||
/// <summary>
|
||||
/// The strongly typed model for the Block List editor.
|
||||
/// Initializes a new instance of the <see cref="BlockListModel" /> class.
|
||||
/// </summary>
|
||||
/// <seealso cref="ReadOnlyCollection{BlockListItem}" />
|
||||
[DataContract(Name = "blockList", Namespace = "")]
|
||||
public class BlockListModel : ReadOnlyCollection<BlockListItem>
|
||||
/// <param name="list">The list to wrap.</param>
|
||||
public BlockListModel(IList<BlockListItem> list)
|
||||
: base(list)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the empty <see cref="BlockListModel" />.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The empty <see cref="BlockListModel" />.
|
||||
/// </value>
|
||||
public static BlockListModel Empty { get; } = new BlockListModel();
|
||||
|
||||
/// <summary>
|
||||
/// Prevents a default instance of the <see cref="BlockListModel" /> class from being created.
|
||||
/// </summary>
|
||||
private BlockListModel()
|
||||
: this(new List<BlockListItem>())
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BlockListModel" /> class.
|
||||
/// </summary>
|
||||
/// <param name="list">The list to wrap.</param>
|
||||
public BlockListModel(IList<BlockListItem> list)
|
||||
: base(list)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="BlockListItem" /> with the specified content key.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The <see cref="BlockListItem" />.
|
||||
/// </value>
|
||||
/// <param name="contentKey">The content key.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="BlockListItem" /> with the specified content key.
|
||||
/// </returns>
|
||||
public BlockListItem? this[Guid contentKey] => this.FirstOrDefault(x => x.Content.Key == contentKey);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="BlockListItem" /> with the specified content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The <see cref="BlockListItem" />.
|
||||
/// </value>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="BlockListItem" /> with the specified content UDI.
|
||||
/// </returns>
|
||||
public BlockListItem? this[Udi contentUdi] => contentUdi is GuidUdi guidUdi ? this.FirstOrDefault(x => x.Content.Key == guidUdi.Guid) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prevents a default instance of the <see cref="BlockListModel" /> class from being created.
|
||||
/// </summary>
|
||||
private BlockListModel()
|
||||
: this(new List<BlockListItem>())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the empty <see cref="BlockListModel" />.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The empty <see cref="BlockListModel" />.
|
||||
/// </value>
|
||||
public static BlockListModel Empty { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="BlockListItem" /> with the specified content key.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The <see cref="BlockListItem" />.
|
||||
/// </value>
|
||||
/// <param name="contentKey">The content key.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="BlockListItem" /> with the specified content key.
|
||||
/// </returns>
|
||||
public BlockListItem? this[Guid contentKey] => this.FirstOrDefault(x => x.Content.Key == contentKey);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="BlockListItem" /> with the specified content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The <see cref="BlockListItem" />.
|
||||
/// </value>
|
||||
/// <param name="contentUdi">The content UDI.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="BlockListItem" /> with the specified content UDI.
|
||||
/// </returns>
|
||||
public BlockListItem? this[Udi contentUdi] => contentUdi is GuidUdi guidUdi
|
||||
? this.FirstOrDefault(x => x.Content.Key == guidUdi.Guid)
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Umbraco.Cms.Core.Models.Blocks;
|
||||
|
||||
namespace Umbraco.Cms.Core.Models.Blocks
|
||||
public struct ContentAndSettingsReference : IEquatable<ContentAndSettingsReference>
|
||||
{
|
||||
public struct ContentAndSettingsReference : IEquatable<ContentAndSettingsReference>
|
||||
public ContentAndSettingsReference(Udi? contentUdi, Udi? settingsUdi)
|
||||
{
|
||||
public ContentAndSettingsReference(Udi? contentUdi, Udi? settingsUdi)
|
||||
{
|
||||
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
||||
SettingsUdi = settingsUdi;
|
||||
}
|
||||
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
public Udi? SettingsUdi { get; }
|
||||
|
||||
public override bool Equals(object? obj) => obj is ContentAndSettingsReference reference && Equals(reference);
|
||||
|
||||
public bool Equals(ContentAndSettingsReference other) => other != null
|
||||
&& EqualityComparer<Udi>.Default.Equals(ContentUdi, other.ContentUdi)
|
||||
&& EqualityComparer<Udi>.Default.Equals(SettingsUdi, other.SettingsUdi);
|
||||
|
||||
public override int GetHashCode() => (ContentUdi, SettingsUdi).GetHashCode();
|
||||
|
||||
public static bool operator ==(ContentAndSettingsReference left, ContentAndSettingsReference right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(ContentAndSettingsReference left, ContentAndSettingsReference right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
ContentUdi = contentUdi ?? throw new ArgumentNullException(nameof(contentUdi));
|
||||
SettingsUdi = settingsUdi;
|
||||
}
|
||||
|
||||
public Udi ContentUdi { get; }
|
||||
|
||||
public Udi? SettingsUdi { get; }
|
||||
|
||||
public static bool operator ==(ContentAndSettingsReference left, ContentAndSettingsReference right) =>
|
||||
left.Equals(right);
|
||||
|
||||
public override bool Equals(object? obj) => obj is ContentAndSettingsReference reference && Equals(reference);
|
||||
|
||||
public bool Equals(ContentAndSettingsReference other) => other != null
|
||||
&& EqualityComparer<Udi>.Default.Equals(
|
||||
ContentUdi,
|
||||
other.ContentUdi)
|
||||
&& EqualityComparer<Udi>.Default.Equals(
|
||||
SettingsUdi,
|
||||
other.SettingsUdi);
|
||||
|
||||
public override int GetHashCode() => (ContentUdi, SettingsUdi).GetHashCode();
|
||||
|
||||
public static bool operator !=(ContentAndSettingsReference left, ContentAndSettingsReference right) =>
|
||||
!(left == right);
|
||||
}
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
namespace Umbraco.Cms.Core.Models.Blocks
|
||||
namespace Umbraco.Cms.Core.Models.Blocks;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data item reference for a Block Editor implementation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See:
|
||||
/// https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a data item reference for a Block Editor implementation.
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See: https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the content UDI.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
Udi ContentUdi { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data item reference with settings for a Block editor implementation.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <remarks>
|
||||
/// See: https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference<TSettings> : IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
TSettings Settings { get; }
|
||||
}
|
||||
/// <value>
|
||||
/// The content UDI.
|
||||
/// </value>
|
||||
Udi ContentUdi { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a data item reference with settings for a Block editor implementation.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSettings">The type of the settings.</typeparam>
|
||||
/// <remarks>
|
||||
/// See:
|
||||
/// https://github.com/umbraco/rfcs/blob/907f3758cf59a7b6781296a60d57d537b3b60b8c/cms/0011-block-data-structure.md#strongly-typed
|
||||
/// </remarks>
|
||||
public interface IBlockReference<TSettings> : IBlockReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the settings.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The settings.
|
||||
/// </value>
|
||||
TSettings Settings { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user