Kommentare zur Dokumentation hinzugefügt und Pakete konfiguriert.

This commit is contained in:
Developer 02
2024-06-20 16:20:50 +02:00
parent b7584a1632
commit 0ad92e7592
19 changed files with 588 additions and 56 deletions

View File

@@ -2,11 +2,25 @@
namespace DigitalData.Core.DTO
{
/// <summary>
/// Represents a result of an operation that includes data, inheriting from <see cref="Result"/>.
/// </summary>
/// <typeparam name="T">The type of the data included in the result.</typeparam>
public class DataResult<T> : Result
{
/// <summary>
/// Gets or sets the data included in the result. This property is required.
/// It will be ignored during JSON serialization if the value is null.
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public required T Data { get; set; }
public DataResult<I> ToFail<I>() => Fail<I>().Message(Messages).Notice(Notices);
}
/// <summary>
/// Converts the current <see cref="DataResult{T}"/> to a failed <see cref="DataResult{I}"/>,
/// preserving the messages and notices.
/// </summary>
/// <typeparam name="I">The type of the data in the new failed result.</typeparam>
/// <returns>A failed <see cref="DataResult{I}"/> with the current messages and notices.</returns>
public DataResult<I> ToFail<I>() => Fail<I>().Message(Messages).Notice(Notices);
}
}