IObjectDataSourceConstructorFilterService.Filter(Type, IEnumerable<ConstructorInfo>) Method
Returns the list of type constructors to display in the Report Wizard and Data Source Wizard.
Namespace: DevExpress.DataAccess.Web
Assembly: DevExpress.DataAccess.v20.2.dll
NuGet Packages: DevExpress.DataAccess, DevExpress.WindowsDesktop.DataAccess
Declaration
IEnumerable<ConstructorInfo> Filter(
Type dataSourceType,
IEnumerable<ConstructorInfo> constructors
)
Parameters
Name | Type | Description |
---|---|---|
dataSourceType | Type | A type that is registered for the Report Wizard and Data Source Wizard. |
constructors | IEnumerable<ConstructorInfo> | The list of constructors declared in the specified type. |
Returns
Type | Description |
---|---|
IEnumerable<ConstructorInfo> | A filtered list of constructors to display in the Report Wizard and Data Source Wizard. |
Remarks
Use this method to specify which constructors the Report Wizard and Data Source Wizard should display. The list of constructors is passed in the constructors parameter. Return a filtered list of constructors.
If the type’s constructor list is not provided, or an IObjectDataSourceConstructorFilterService interface is not implemented or registered, the Report Wizard and Data Source Wizard display all constructors.
Constructors Are Not Filtered | Constructors With No Parameters Are Filtered Out |
---|---|
If a constructor accepts parameters, users can specify parameter values.
Specify default parameter values if needed.
The code sample below shows how to implement the Filter method.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using DevExpress.DataAccess.Web;
// ...
public class CustomObjectDataSourceConstructorFilterService : IObjectDataSourceConstructorFilterService {
public IEnumerable<ConstructorInfo> Filter(Type dataSourceType, IEnumerable<ConstructorInfo> constructors) {
if(dataSourceType == typeof(SampleObjectTypes.DataSource2)) {
return constructors;
}
return constructors.Where(x => x.GetParameters().Length > 0);
}
}