forked from ddrilling/AsbCloudServer
27 lines
685 B
C#
27 lines
685 B
C#
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
|
|
namespace AsbCloudApp.Data;
|
|
|
|
/// <summary>
|
|
/// Результат валидации объекта
|
|
/// </summary>
|
|
public class ValidationResultDto<T>
|
|
where T : class
|
|
{
|
|
/// <summary>
|
|
/// Флаг валидности
|
|
/// </summary>
|
|
public bool IsValid => !Warnings.Any();
|
|
|
|
/// <summary>
|
|
/// Объект валидации
|
|
/// </summary>
|
|
public virtual T Item { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Предупреждения
|
|
/// </summary>
|
|
public IEnumerable<ValidationResult> Warnings { get; set; } = Enumerable.Empty<ValidationResult>();
|
|
} |