PropertyValueAttributeCache
A cacher class that is being used to retrieve the existing mapped PropertyValueAttribute objects of a property. Underneath, it uses the PropertyValueAttributeMapper class to extract the mappings and caching it for future use.
Methods
Below are the methods available from this class.
Flush | Allows you to flush the caches. |
Get | Returns the list of PropertyValueAttribute objects. |
Usability
You can simply call the Get()
method of this class by passing the type of the class and the name of the property.
var attributes = PropertyValueAttributeCache.Get(typeof(Person), "Name");
// Use the 'attributes' here
Or, via a property expression.
var attributes = PropertyValueAttributeCache.Get<Person>(e => e.Name);
// Use the 'attributes' here