Hi, I would like to get all the data of the schema and I know that there is a limit in each call.
Therefore, I wanna use recursive function to call it with using T type in C#.
However, I don’t know how to pass the type to the client.
public async Task<Object> test<TE, TD>(IContentsClient<TE, TD> Client, string filter, int skipCount)
{
var Result = await Client.GetAsync(new ContentQuery { Filter = filter, Skip = skipCount });
if (Result.Items.Count() + skipCount < Result.Total)
Result.Items.AddRange(test<TE, TD>(Client, filter, skipCount + Result.Items.Count()));
return Result;
}
Very often this method is used for backups or export functionality. For example when you want to write 1.000.000 million records from Squidex to your database, it is a bad idea to add all records to a list first because this needs too much memory. And writing to a file or database is usually an async operation.
Depends how much you filter out. If you are only interested in 10% of the total records, it is faster to make a query, if you are interested in 90% of the total records I would do it in your program.