| layout | default | ||
|---|---|---|---|
| sidebar | cachers | ||
| title | ClassMappedNameCache | ||
| description | A class that is being used to retrieve the cached name of the class or data entity. | ||
| permalink | /cacher/classmappednamecache | ||
| tags |
|
||
| parent | CACHERS |
A cacher class for the class name mapping. Underneath, it uses the ClassMapper class to extract the results and caching it for future use. It provides a 2nd-layer caching for the library when it comes to the class name mapping extraction.
{: .note }
Internally, this class is widely used within the library.
Below is the list of methods.
| Name | Description |
|---|---|
| Flush | Allows you to flush the caches. |
| Get | Returns the mapped name of the class. |
You can simply call the Get() method of this class by passing the class type.
var mappedName = ClassMappedNameCache.Get(typeof(Person));
// Use the 'mappedName' hereOr, via generic type.
var mappedName = ClassMappedNameCache.Get<Person>();
// Use the 'mappedName' here{: .note }
The extraction is first checking the presence of the Map attribute and extract the name-mapping from there, then checks the implicit-mapping, otherwise, it will use the
typeof(Class).Nameof theSystem.Reflection.