When an ADF is generated using BDC Editor tool, by default no filters will be added to any method instance. There is an option available in BDC editor tool to create filter. For guys who have tried to create filters using BDC Editor tool know how much painful it is. I know that there are other tools available in market using which this can be achieved easily but remember that nothing comes for free !
Let’s remember that nothing is as great as “Programming Ourselves” and that is what exactly we are going to do. Once you know what changes need to be done and why, then it’s just a matter of time to change.
So, first create ADF using the BDC Editor tool and save it. Open the XML file and locate the method where you like to add filters.
1. Change the Query adding where clause in it. Remember, the field in the where clause is going to be the filter.
Select “EmployeeKey”,”FirstName” from DimEmployee where([EmployeeKey] LIKE @ EmployeeKey)
2. Add Filter Descriptors and parameters in it. Here we are assuming it’s a Comparison type – you can also use WildCharacter.
<FilterDescriptor Type=“Comparison“ Name=“EmployeeKey“ />
<Parameter Direction=“In“ Name=“@ EmployeeKey “>
<TypeDescriptor TypeName=“System.Int32“ Name=“EmployeeKey“ AssociatedFilter=“EmployeeKey“ IdentifierName=“[EmployeeKey]“>
<DefaultValue MethodInstanceName=“FindAll_DimEmployee_Instance“ Type=“System.Int32“>1</DefaultValue>
3. Make sure that MethodInstanceName specified in the default value matches with the method instance name specified in <MethodInstances>