IObjectDataSourceValidationService Interface

Allows custom validation of the ObjectDataSource data sources before using them in the document.

Namespace: DevExpress.Snap.Services

Assembly: DevExpress.Snap.v20.1.Core.dll


public interface IObjectDataSourceValidationService
Public Interface IObjectDataSourceValidationService


The ObjectDataSource can cause an undesired behavior when retrieving its data. This may be unacceptable in certain situations. You can use the SnapControlOptions.DataSourceOptions option to specify whether to prohibit the ObjectDataSource data retrieval, prompt the user or silently load the data. To prompt the user, the default IObjectDataSourceValidationService implementation is called. However, you can implement your own service with a custom IObjectDataSourceValidationService.Validate method to replace the default service.


            snapControl1.ReplaceService<IObjectDataSourceValidationService>(new MyObjectDataSourceValidationService());
public class MyObjectDataSourceValidationService : IObjectDataSourceValidationService {
    public void Validate(IEnumerable<ObjectDataSource> dataSources) {
        // Do nothing to allow loading.
        // Clear the DataSource and DataMember properties to prohibit loading.
        foreach (ObjectDataSource ds in dataSources) {
            ds.DataSource = null;
            ds.DataMember = null;
See Also