refactor(Application.Abstractions): umbenennen in Abstractions.Application
This commit is contained in:
28
DigitalData.Core.Abstraction.Application/DTO/DataResult.cs
Normal file
28
DigitalData.Core.Abstraction.Application/DTO/DataResult.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DigitalData.Core.Abstraction.Application.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>
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
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)]
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public required T Data { get; set; }
|
||||
|
||||
/// <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>
|
||||
[Obsolete("Use DigitalData.Core.Exceptions and .Middleware")]
|
||||
public DataResult<I> ToFail<I>() => Fail<I>().Message(Messages).Notice(Notices);
|
||||
}
|
||||
Reference in New Issue
Block a user