uon-nuget / UoN.ExpressiveAnnotations.NetCore

Annotation-based conditional validation library.
Other
29 stars 12 forks source link

Updated ExpressiveValidator to use MemoryCache for caching #24

Closed MmmBerry closed 5 years ago

MmmBerry commented 5 years ago

Closes #13.

Modified the ExpressiveValidator class to use MemoryCache for caching rather than the original custom ProcessStorage and RequestStorage classes.

The RequestCache wrapper class is used to allow that cache to be scoped to the request. Both caches are injected via the HttpRequest in the Attribute classes, then passed to the Validator.

The registration of the cache services in the Sample Project is updated to use MemoryCache, and this is abstracted into an extension method.

Documentation is also updated to reflect the simplified mechanism of registering ExpressiveAnnotations via the extension method.