Filter an Entity Framework Data Source

Use the EFDataSource.Filters property to access an Entity Framework data source's filters collection. This collection contains DBSetFilter objects that provide the settings required to filter a data source table.

The following code assigns a new filter string without referring to any parameters:

// ...
dataSource.Filters["Products"] = "ProductID = 1";

The following code makes a filter string refer to a parameter:


DBSetFilter filter = new DBSetFilter("Products", "ProductID = ?p1");
filter.Parameters.Add(new EFParameter("p1", typeof(int), 1));