public static IMappingOperationOptions UseEntityCache <TKey, TEntity>( this IMappingOperationOptions options, IEntityCacheAccessor <TKey, TEntity> entityCache) where TEntity : class { EntityCacheResolutionContextHelper.Add(options.Items, entityCache); return(options); }
public static void Add <TKey, TEntity>(IDictionary <string, object> items, IEntityCacheAccessor <TKey, TEntity> cacheAccessor) where TEntity : class { var entityKeys = GetEntityKeysDictionary <TEntity>(items); if (entityKeys.ContainsKey(typeof(TKey))) { throw new InvalidOperationException( $"'{nameof(IEntityCacheAccessor<TKey, TEntity>)}' entity cache has already been added to mapping options."); } entityKeys.Add(typeof(TKey), cacheAccessor); }