我正在尝试扩展CachedDataAnnotationsModelMetadataProvider
到不缓存 Custom ValidationAttribute
。我怎样才能做到这一点?我尝试查看 aspnetwebstack,但答案太复杂了;我需要覆盖什么,作为受保护的覆盖
protected override CachedDataAnnotationsModelMetadata CreateMetadataFromPrototype(
CachedDataAnnotationsModelMetadata prototype,
Func<object> modelAccessor)
和
protected override CachedDataAnnotationsModelMetadata CreateMetadataPrototype(
IEnumerable<Attribute> attributes,
Type containerType,
Type modelType,
string propertyName)
和CachedAssociatedMetadataProvider<TModelMetadata>
方法
protected sealed override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
被密封。有任何想法吗 ?