PropertyHandlerCache
A cacher class for the IPropertyHandler objects that has been mapped to .NET CLR type or class property. Underneath, it uses the PropertyHandlerMapper class to extract the results 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 instance of the property handler. |
Usability
You can simply call the Get()
method of this class by passing the class type.
Type Level
var propertyHandler = PropertyHandlerCache.Get<IntTypeProperHandler>(typeof(int));
// Use the 'propertyHandler' here
Or via generic.
var propertyHandler = PropertyHandlerCache.Get<int, IntTypeProperHandler>();
// Use the 'propertyHandler' here
Property Level
var propertyHandler = PropertyHandlerCache.Get<Customer, CustomerAddressPropertyHandler>("Address");
// Use the 'propertyHandler' here
Or via generic.
var propertyHandler = PropertyHandlerCache.Get<Customer, CustomerAddressPropertyHandler>(e => e.Address);
// Use the 'propertyHandler' here