public FetchGroupedDataLoader(FetchGrouped <TKey, TValue> fetch) : base(new DataLoaderOptions <TKey> { AutoDispatching = false, Batching = true, CacheSize = DataLoaderDefaults.CacheSize, MaxBatchSize = DataLoaderDefaults.MaxBatchSize, SlidingExpiration = TimeSpan.Zero }) { _fetch = fetch ?? throw new ArgumentNullException(nameof(fetch)); }
public static IDataLoader <TKey, TValue[]> DataLoader <TKey, TValue>( this IResolverContext context, string key, FetchGrouped <TKey, TValue> fetch) { if (string.IsNullOrEmpty(key)) { // TODO : resources throw new ArgumentException( "The DataLoader key cannot be null or empty.", nameof(key)); } if (fetch == null) { throw new ArgumentNullException(nameof(fetch)); } return(DataLoader(context, key, services => fetch)); }
public static bool Register <TKey, TValue>( this IDataLoaderRegistry registry, string key, FetchGrouped <TKey, TValue> fetch) { if (string.IsNullOrEmpty(key)) { // TODO : Resources throw new ArgumentException( "The DataLoader key cannot be null or empty.", nameof(key)); } if (fetch == null) { throw new ArgumentNullException(nameof(fetch)); } return(registry.Register(key, services => new FetchGroupedDataLoader <TKey, TValue>(fetch))); }