IObjectDataSourceMemberFilterService.Filter(Type, IEnumerable<MemberInfo>) Method
Returns the list of type members to display in the Report Wizard and Data Source Wizard.
Namespace: DevExpress.DataAccess.Web
Assembly: DevExpress.DataAccess.v21.2.dll
NuGet Packages: DevExpress.DataAccess, DevExpress.Win.Design
Declaration
Parameters
Name | Type | Description |
---|---|---|
dataSourceType | Type | A type that is registered for the Report Wizard and Data Source Wizard. |
members | IEnumerable<MemberInfo> | The list of type members that return IEnumerable<T> values. |
Returns
Type | Description |
---|---|
IEnumerable<MemberInfo> | The filtered list of type members to display in the Report Wizard and Data Source Wizard. |
Remarks
Use this method to specify which type members the Report Wizard and Data Source Wizard should display. The list of members is passed in the members parameter. Return a filtered list of members.
Items in the members parameter are sorted alphabetically by name. If you apply the DisplayName attribute to a member, the specified display name is used instead.
If the type’s member list is not provided, or an IObjectDataSourceMemberFilterService interface is not implemented or registered, the Report Wizard and Data Source Wizard display all members that return IEnumerable<T> values.
Members Are Not Filtered | Members With No Parameters Are Filtered Out |
---|---|
If a member 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 CustomObjectDataSourceMemberFilterService : IObjectDataSourceMemberFilterService {
public IEnumerable<MemberInfo> Filter(Type dataSourceType, IEnumerable<MemberInfo> members) {
if(dataSourceType == typeof(SampleObjectTypes.DataSource2)) {
return members;
}
return members.Where(x => {
var method = x as MethodInfo;
if(method != null) return method.GetParameters().Length > 0;
return false;
});
}
}