Working with external content types isn’t as straight forward as it should be, especially within a Visual Studio project. Take trying to define the display order of your columns as an example.
You define your task entity by adding your required Type Descriptors in BDC Explorer. The order the columns will display in external views is dependant on the order they are listed in the BDC Explorer. That’s all well and good but there’s no way through the UI to change this order.
The easiest way to change the order is to directly edit the dbcm file in your favourite text editor, mine is Notepad++. Other text editors are available 🙂
In Visual Studio, right click your model in the Solution Explorer pane and click Open Folder in File Explorer. In the folder that loads, open the bdcm file in your editor of choice.
In the schema that loads, look for the method name that matches the method you want to alter the display order for.
<Methods> <Method Name="ReadItem"> <Parameters> <Parameter Name="entityObject" Direction="Return">
Where the method name is the value of the Name attribute in the Method node.
Within this section, you’ll see a TypeDescriptors node with all of the fields you added stored as child TypeDescriptor nodes.
<TypeDescriptor Name="entityObject" TypeName="SharePoint.OM.EntityObject, SharePoint.OM" IsCollection="false" ReadOnly="true"> <TypeDescriptors> <TypeDescriptor DefaultDisplayName="Entity Title" Name="EntityTitle" TypeName="System.String" ReadOnly="true" /> <TypeDescriptor DefaultDisplayName="Entity Description" Name="EntityDescription" TypeName="System.String" ReadOnly="true" /> <TypeDescriptor DefaultDisplayName="Entity Owner" Name="EntityOwner" TypeName="System.String" ReadOnly="true" />
Simply rearrange the order in this file to change the order they appear in the related external list view. In the above example, changing the order would affect the ReadItem view.
Now, if you have a lot of finder methods defined and want them all to have the same order, you’ll need to ensure the order is correct for each method. If they are all identical it’s probably easier and quicker to copy and paste the TypeDescriptors node across all the related methods.
You’ll then need to redeploy and recreate the external list for this to take effect.
Before redeploying I recommend manually deleting the external content type(s) and BDC Model from your Business Data Connectivity Service application.
This will ensure the new version is correctly deployed and the changes you made updated. If you don’t perform this step you run the risk of the deployment process not removing the previous version correctly and when the new solution is deployed the definition remains the same.
To delete the external content types, navigate to the BDC service application management page in your Central Administration site. Highlight the relevant content types and click Delete in the ribbon.
To the right of the ribbon is a drop down list, change this to BDC Models, select the model(s) you want to update and once again click Delete in the ribbon.
Retract your solution, redeploy and then recreate the external list. All going well, the updated views will reflect the field order specified in the bdcm file.