The ICacheFactory to be used as the type identity cache of the configured DataDomain. Setting this to a null reference disables the caching of type identites. The default is to use a SimpleCache as type identity cache.
The type identity cache of a DataDomain stores the dynamic type of objects based on their identity, like a mapping of (Object Identity -> Type). The main purpose of this cache is to speed up the lazy loading strategies in polymorphic scenarios: Genome can retrieve a proxy to a related object (based on the FK fields) without reading data from the database if the dynamic type of that object is already known.
The type identity cache is bound to the data domain, so it can be considered it as “static” from the application’s point of view. By default, a data domain uses SimpleCache as type identity cache, meaning that it does not drop any of the cached entries and remembers the dynamic type of all loaded objects based on their id fields. Please note that this cache stores type information only. It is independent of the state of the objects, which might or might not be cached in the context cache.
Creating a data domain with an LruCache to be used as the type identity cache.
DataDomainConfiguration dataDomainConfig = new DataDomainConfiguration(connectionString, schema); dataDomainConfig.TypeIdentityCache = new LruCache(10, 5, new ManualInvalidation()); DataDomain dataDomain = new DataDomain(dataDomainConfig);
Creating a data domain with the type identity cache disabled.
DataDomainConfiguration dataDomainConfig = new DataDomainConfiguration(connectionString, schema); dataDomainConfig.TypeIdentityCache = null; DataDomain dataDomain = new DataDomain(dataDomainConfig);
Assembly: TechTalk.Genome (in TechTalk.Genome.dll)
Editions: Professional, Evaluation, Express