using System.ComponentModel.DataAnnotations;
using DS.Module.Core.Extensions;
namespace DS.Module.Core.Data;
///
/// id实体
///
public class IdModel : IValidatableObject
{
///
/// 主键id
///
public string? Id { get; set; }
///
/// 主键ids
///
public long[] Ids { get; set; }
///
/// 业务类型:1、海运出口 2、海运进口
///
public int? BusinessType { get; set; }
///
/// 请求值
///
public object? Value { get; set; }
///
/// 备注
///
public string? Remark { get; set; }
///
/// 确定当前对象是否有效
///
/// 验证上下文
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (Id.IsNullOrEmpty() && (Ids == null || Ids.Length == 0))
{
yield return new ValidationResult($"未指定 {nameof(Ids)},参数无效");
}
}
}
///
/// ID实体的泛型版本
///
/// 请求值的类型
public class IdModel : IdModel
{
///
/// 请求值
///
public new T? Value { get; set; }
}