TypeMapCache
A cacher class for database type objects mapped to .NET CLR types or class properties. It uses PropertyHandlerMapper internally to extract results and caches them 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 database type (via DbType object). |
Usability
Call the Get() method by passing the class type.
Type Level
var dbType = TypeMapCache.Get(typeof(int));
// Use the 'dbType' here
Or via generic type:
var dbType = TypeMapCache.Get<int>();
// Use the 'dbType' here
Property Level
var propertyHandler = TypeMapCache.Get<Customer>("Address");
// Use the 'propertyHandler' here
Or via expression:
var dbType = TypeMapCache.Get<Customer>(e => e.Address);
// Use the 'dbType' here