Back to Devexpress

JsonDataSource.SchemaDiscoveryMaxItemCount Property

corelibraries-devexpress-dot-dataaccess-dot-json-dot-jsondatasource.md

latest3.4 KB
Original Source

JsonDataSource.SchemaDiscoveryMaxItemCount Property

Specifies how many data source elements to analyze on each level to build the schema.

Namespace : DevExpress.DataAccess.Json

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[DefaultValue(100)]
[LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)]
public int SchemaDiscoveryMaxItemCount { get; set; }
vb
<DefaultValue(100)>
<LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)>
Public Property SchemaDiscoveryMaxItemCount As Integer

Property Value

TypeDefaultDescription
Int32100

The number of data source elements to analyze on each level to build the schema.

|

Remarks

Use this property to limit the number of data source records that the JsonDataSource uses to build the schema. This improves performance for data sources with a large number of records.

Set this property to 0 to analyze all data source records.

If a record contains an array of nested records, the same limit applies to the nested records to build their schema.

This property is not in effect if the Schema property has a value different from null ( Nothing in Visual Basic) before you call the Fill() method.

In the Data Source Wizard , you can use the IWizardJsonDataSourceSchemaDiscoveryInterceptor service to specify the SchemaDiscoveryMaxItemCount value.

Example

The code sample below creates a new JSON data source and uses the first 5 records to build the schema.

csharp
using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
// ...
// Create a new JSON source.
var jsonSource = new UriJsonSource() {
    Uri = new Uri(@"https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")
};
// Assign the JSON source to the data source. Use the first 5 records to build the schema.
var datasource = new JsonDataSource() {
    JsonSource = jsonSource,
    SchemaDiscoveryMaxItemCount = 5
};
vb
Imports DevExpress.DataAccess
Imports DevExpress.DataAccess.Json
' ...
' Create a new JSON source.
Dim jsonSource = New UriJsonSource() With {.Uri = New Uri("https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json")}
' Assign the JSON source to the data source. Use the first 5 records to build the schema.
Dim datasource = New JsonDataSource() With {.JsonSource = jsonSource, .SchemaDiscoveryMaxItemCount = 5}

See Also

JsonDataSource Class

JsonDataSource Members

DevExpress.DataAccess.Json Namespace