public FetchSingleDataLoader( FetchCache <TKey, TValue> fetch, int cacheSize, DataLoaderOptions <TKey> options) : base(options) { _fetch = fetch ?? throw new ArgumentNullException(nameof(fetch)); }
public FetchSingleDataLoader( FetchCache <TKey, TValue> fetch, int cacheSize) : base(new DataLoaderOptions <TKey> { AutoDispatching = false, Batching = false, CacheSize = cacheSize, MaxBatchSize = DataLoaderDefaults.MaxBatchSize, SlidingExpiration = TimeSpan.Zero }) { _fetch = fetch ?? throw new ArgumentNullException(nameof(fetch)); }
public static bool Register <TKey, TValue>( this IDataLoaderRegistry registry, string key, FetchCache <TKey, TValue> fetch) { if (string.IsNullOrEmpty(key)) { throw new ArgumentException( TypeResources.DataLoaderRegistry_KeyNullOrEmpty, nameof(key)); } if (fetch == null) { throw new ArgumentNullException(nameof(fetch)); } return(registry.Register(key, services => new FetchSingleDataLoader <TKey, TValue>(fetch))); }
public static IDataLoader <TKey, TValue> CacheDataLoader <TKey, TValue>( this IResolverContext context, string key, FetchCache <TKey, TValue> fetch) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (string.IsNullOrEmpty(key)) { throw new ArgumentException( TypeResources.DataLoaderRegistry_KeyNullOrEmpty, nameof(key)); } if (fetch == null) { throw new ArgumentNullException(nameof(fetch)); } return(CacheDataLoaderFactory(context, key, services => fetch)); }
public FetchSingleDataLoader(FetchCache <TKey, TValue> fetch) : this(fetch, DataLoaderDefaults.CacheSize) { }
protected CacheDataLoader(FetchCache <TKey, TValue> fetch) : base(_defaultOptions) { }