If you have a large OData CSDL model that contains many entity types or entity sets you are not interested in, it might be hard for you to open the CSDL modeler using the CSDL modeler due to the performance reasons. On the other hand, if you’re trying to build a mobile application that consumes this OData service, and it might be slow to generate proxy classes using the proxy compiler and it ends up generating many proxy classes your mobile application doesn’t really need. With the latest SAP Mobile Services OData CSDL Modeler, you will be able to prune the CSDL model and generate a new CSDL model that only contains a subset of the entity types or entity sets, and it becomes easy for you to build your mobile application based on the pruned model by running the proxy compiler in Android Studio or iOS assistant.
Pruning the CSDL model using the CSDL modeler
In order to use the pruning functionality, you need to download the latest CSDL modeler from SAP Mobile Services OData CSDL modeler. Then you can open your CSDL model using the modeler:
And then click the prune toolbar button:
and you will see a dialog pops up:
In this dialog, select the entity types that you want to include in the pruned model:
Click “OK” button to close the dialog and the modeler will generate the CSDL model that contains the selected entity types and entity types that are directly related to the selected ones:
From the above screenshot, you can see a pruned model in the diagram that contains only 10 entity types.
If you want to use the pruned CSDL model as a file so that you can run proxy compiler to generate proxy classes, you can click the “Export” button in the toolbar and select “Export pruned model” menu item:
Save the pruned model to your workspace and you should be able to use it for your mobile application development, for example, proxy classes generation as described in https://blogs.sap.com/2018/06/06/feature-spotlight-sap-cloud-platform-sdk-for-android-wizard/ or https://blogs.sap.com/2018/02/14/getting-started-with-the-sap-cloud-platform-sdk-for-ios-part-1/ in your correspoding IDEs:
In this blog, we demonstrated how to prune a large CSDL model using the latest CSDL modeler so that it’s easier for mobile developers to generate proxy classes using proxy compiler for iOS or Android for the mobile application development. If you are trying to visualize a very big OData CSDL model using the modeler, the modeler will ask you to prune to model first so that you have better user experiences as well.