using System.ComponentModel.DataAnnotations; using Dlhis.Common.FileOperation.Constants; using Microsoft.AspNetCore.Mvc; namespace Dlhis.Common.FileOperation.Request; public class UploadFileRequest : IValidatableObject { /// /// bucket /// [FromRoute] public string Bucket { get; set; } /// /// 文件 /// public IFormFile File { get; set; } public IEnumerable Validate(ValidationContext validationContext) { if (!FileBucketConstants.Buckets.Contains(Bucket)) { yield return new ValidationResult($"不支持{Bucket}", new[] { nameof(Bucket) }); } } }