IDataApiEnumerate Method (DataSourceEnumerationQuery, CancellationToken)
|
Query and loop through an extensive collection without writing a lot of code for data paging,
Which is also inefficient when dealing with 100k+ records.
Namespace:
Casewhere.Runtime.DSL.Api
Assembly:
Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.8.1.0
Syntax IEnumerable<DynamicDataObject> Enumerate(
DataSourceEnumerationQuery queryBuilder,
CancellationToken token = default
)
Parameters
- queryBuilder
- Type: Casewhere.Runtime.DSL.ApiDataSourceEnumerationQuery
An instance of the DataSourceEnumerationQuery type.
The param contains Data Source Name, Batch Size, Filter, ProjectedFields, SortedFields.
The Instances of DataSourceEnumerationQuery can't create directly.
It is just create from static method DataSourceEnumerationQuery.For("dataSourceName").
- token (Optional)
- Type: System.ThreadingCancellationToken
an instance of CancellationToken. If it isn't passed, the default value will be assigned.
Return Value
Type:
IEnumerableDynamicDataObject
The method will returns DynamicDataObject list
Examples var dataApi = ctx.Use<IDataApi>();
var filter = FilterBuilder.Create().Eq("Active", true).Eq("IsDeleted", false).Build();
var query = DataSourceEnumerationQuery.For("EmployeeWithCompany").FilterBy(filter);
foreach (var employee in dataApi.Enumerate(query))
{
var employee = item;
Log.Info("Employee - {name}", employee["Name"]);
var company = employee["Company"];
Log.Info("Company - {name}", company["Name"]);
}
See Also