Below method gives me error at line "await tableRecords.Add( newprops );" on parameter newprops saying
cannot convert to System.Threading.Task.Task<Microsoft.Azure.Cosmos.Table.DynamicTableEntity>. What wrong am I doing here??
I am trying to add new values in my table records which I am inserting in an Azure table storage.
public async Task WriteToTable( Stream lines, DataClass dataclass,
Func<Dictionary<string, EntityProperty>, Task<(string, string)>> genKeys,
Func<Dictionary<string, EntityProperty>, Task<List<string>>> generateColumns, List<string> columnsList, DynamicTableEntity tableEntry,
bool upsert )
{
const int BatchSize = 100;
if( HasPartitionAndRowKey( dataclass.TableSchema.Fields ) )
{
genKeys = ( Dictionary<string, EntityProperty> props ) => Task.FromResult( (props["PartitionKey"].StringValue, props["RowKey"].ToString()) );
}
var tableRecords = ReadCSV( lines, dataclass.TableSchema.Fields )
.Select( async props =>
{ var (partitionKey, rowKey) = await genKeys( props );
return new DynamicTableEntity( partitionKey, rowKey, string.Empty, props );
} ).ToList();
if( columnsList != null )
{
var newColumnValues = ReadCSV( lines, dataclass.TableSchema.Fields )
.Select( async prop => { await generateColumns( prop ); } ).ToList();
var arr = newColumnValues.ToArray();
var newprops = new DynamicTableEntity();
for( int i = 0; i < columnsList.Count; i++ )
{
newprops.Properties.Add( columnsList[i], EntityProperty.CreateEntityPropertyFromObject( arr[i] ) );
await tableRecords.Add( newprops );
}
await BatchInsertIntoTableStorage( BatchSize, tableRecords, upsert );
}
await BatchInsertIntoTableStorage( BatchSize, tableRecords, upsert );
}