Skip to main content
A newer version of this page is available. .
All docs
V22.1

IWizardJsonDataSourceSchemaDiscoveryInterceptor Interface

Allows you to specify the number of data source records that the JsonDataSource uses to build the schema.

Namespace: DevExpress.DataAccess.Web

Assembly: DevExpress.DataAccess.v22.1.dll

NuGet Package: DevExpress.DataAccess

Declaration

public interface IWizardJsonDataSourceSchemaDiscoveryInterceptor

Remarks

When you connect JsonDataSource to the JSON file, it scans the data in the first lines of the JSON file and creates a schema based on this analysis. Sometimes there are more fields in the rows that were not scanned to create the schema. If you notice that the field you want is missing from the schema, you can increase the JsonDataSource.SchemaDiscoveryMaxItemCount value.

The IWizardJsonDataSourceSchemaDiscoveryInterceptor service allows you to intercept schema discovery actions that the Data Source Wizard performs, and specify the SchemaDiscoveryMaxItemCount value.

You can implement the service as follows:

using DevExpress.DataAccess.Json;
using DevExpress.DataAccess.Web;
class CustomWizardJsonDataSourceSchemaDiscoveryService : IWizardJsonDataSourceSchemaDiscoveryInterceptor
    {
        public JsonDataSource Customize(JsonDataSource ds)
        {
            ds.SchemaDiscoveryMaxItemCount = 3;
            return ds;
        }
    }

You should register a service at application startup:

using DevExpress.DataAccess.Web;
// ...
services                
    .AddScoped<IWizardJsonDataSourceCustomizationService, CustomWizardJsonDataSourceSchemaDiscoveryService>()
See Also