Files
Umbraco-CMS/src/Umbraco.Core/Models/ReadOnlyContentBaseAdapter.cs
Ivo van der Bruggen c3e93f143c Fix nullability of return types that can be non-null (#15927)
* Fix nullability of Children extension

* Fix nullability of methods throughout the CMS

* Fix return types of some methods that cannot return null

* Revert nullable changes to result of ConvertSourceToIntermediate for property editors (whilst some property editors we know won't return null, it seems more consistent to adhere to the base class and interface nullability definition).

* Updated new webhook events to align with new nullability definitions.

* Reverted content editing service updates to align with base classes.

* Applied collection nullability updates on content repository to interface.

* Reverted value converter updates to match interface.

* Applied further collection updates to interface.

* Aligned media service interface with implementation for nullability.

* Update from code review.

---------

Co-authored-by: Ivo van der Bruggen <ivo@dutchbreeze.com>
Co-authored-by: Ivo van der Bruggen <ivo@vdbruggensoftware.com>
Co-authored-by: Andy Butland <abutland73@gmail.com>
2025-07-30 14:19:20 +02:00

38 lines
994 B
C#

namespace Umbraco.Cms.Core.Models;
public struct ReadOnlyContentBaseAdapter : IReadOnlyContentBase
{
private readonly IContentBase _content;
private ReadOnlyContentBaseAdapter(IContentBase content) =>
_content = content ?? throw new ArgumentNullException(nameof(content));
public int Id => _content.Id;
public static ReadOnlyContentBaseAdapter Create(IContentBase content) => new(content);
public Guid Key => _content.Key;
public DateTime CreateDate => _content.CreateDate;
public DateTime UpdateDate => _content.UpdateDate;
public string? Name => _content.Name;
public int CreatorId => _content.CreatorId;
public int ParentId => _content.ParentId;
public int Level => _content.Level;
public string Path => _content.Path;
public int SortOrder => _content.SortOrder;
public int ContentTypeId => _content.ContentTypeId;
public int WriterId => _content.WriterId;
public int VersionId => _content.VersionId;
}