I'm trying to extend CachedDataAnnotationsModelMetadataProvider to not cache Custom ValidationAttribute.
How can i achieve this? I tried looking in aspnetwebstack, but it is too complicated to get answer; what do i need to override, as protected override
protected override CachedDataAnnotationsModelMetadata CreateMetadataFromPrototype(
CachedDataAnnotationsModelMetadata prototype,
Func<object> modelAccessor)
and
protected override CachedDataAnnotationsModelMetadata CreateMetadataPrototype(
IEnumerable<Attribute> attributes,
Type containerType,
Type modelType,
string propertyName)
And CachedAssociatedMetadataProvider<TModelMetadata> method
protected sealed override ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName)
is sealed. Any ideas ?
My problem was that client validations were not updated due to initialization of properties in constructor. So I moved property loading into