How it works...

To describe this, it is best to step through the key parts of the code.

The first part was clicking on Save on the ODataClient.tt file. This created the class by reading the URL we entered in the metadataDocumentURI variable. When the file is saved, it triggers the generation of code using metadata from Dynamics 365 for Finance and Supply Chain Management. If you click on Save, and then cancel the security warning, the ODataClient.cs file will be emptied. Unless we set the TempFilePath string constant, the entire metadata will be added to the ODataClient.cs file. This will not only make the file slow to open, but it can also cause errors when the project is run. There is a maximum size for string constants in C# projects that ...

Get Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.