2025-11-02 18:58:01 +08:00
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2025-11-02 22:14:34 +08:00
|
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
2025-11-02 18:58:01 +08:00
|
|
|
using SimApi.ModelBinders;
|
|
|
|
|
|
|
|
|
|
namespace SimApi.Attributes;
|
|
|
|
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Parameter)]
|
|
|
|
|
public class AesBodyAttribute : ModelBinderAttribute
|
|
|
|
|
{
|
|
|
|
|
public Type KeyProvider { get; set; } = typeof(AesBodyProviderBase);
|
2025-11-02 22:14:34 +08:00
|
|
|
public override BindingSource BindingSource => BindingSource.Body;
|
2025-11-02 18:58:01 +08:00
|
|
|
|
|
|
|
|
public AesBodyAttribute()
|
|
|
|
|
{
|
|
|
|
|
// 指定使用自定义的模型绑定器
|
|
|
|
|
BinderType = typeof(AesBodyModelBinder);
|
|
|
|
|
Name = KeyProvider.FullName;
|
|
|
|
|
}
|
|
|
|
|
}
|