private async Task <object> TryExecuteBatchGetAsync(TranslationResult translationResult, Type entityType) { var batchGet = translationResult.GetBatchGetOperationForTable(this.TableDefinition); if (batchGet == null) { return(null); } // if a projection is specified - then getting only the required list of fields if (translationResult.AttributesToGet != null) { batchGet.AttributesToGet = translationResult.AttributesToGet; } translationResult.CustomizationHooks.ConfigureBatchGetOperationCallback?.Invoke(batchGet); // using async method, because it's the only available in .Net Core version await batchGet.ExecuteAsync() .ConfigureAwait(false); // This is important, as this method can be called synchronously from outside. Without this line it will hang in ASP.Net. this.Log("DynamoDb batch get: {0}", translationResult); return(this.CreateDocArrayReader(batchGet.Results, entityType, translationResult.ProjectionFunc)); }
private bool TryExecuteBatchGet(TranslationResult translationResult, Type entityType, out object resultingReader) { resultingReader = null; var batchGet = translationResult.GetBatchGetOperationForTable(this.TableDefinition); if (batchGet == null) { return(false); } // if a projection is specified - then getting only the required list of fields if (translationResult.AttributesToGet != null) { batchGet.AttributesToGet = translationResult.AttributesToGet; } batchGet.Execute(); this.Log("DynamoDb batch get: " + translationResult); resultingReader = this.CreateDocArrayReader(batchGet.Results, entityType, translationResult.ProjectionFunc); return(true); }