2

We are trying to use Microsoft's OData Client to generate C# classes for our custom entities in Microsoft Dynamics. We add the "OData Connected Service" extension to Visual Studio and connect to the Dynamics $metadata endpoint to generate the client code, as per the instructions.

We end up with over 1,100 source files generated and well over a million lines of code. Sometimes the code generation crashes Visual Studio. Another time we got an Out of Memory exception. This happens even when we limit the generated entities to our own custom entities in Dynamics.

The worst part is the generated code does not compile. The most common compiler error is:

The type or namespace name 'RelationshipAttribute' does not exist in the namespace 'Microsoft.Dynamics.CRM' (are you missing an assembly reference?)

Here is an example source code line that causes this error:

private global::System.Collections.ObjectModel.Collection<global::Microsoft.Dynamics.CRM.RelationshipAttribute> _RelationshipAttributes = new global::System.Collections.ObjectModel.Collection<global::Microsoft.Dynamics.CRM.RelationshipAttribute>();

Does anyone have an idea why this is happening?

Tom Baxter
  • 2,110
  • 2
  • 19
  • 38

0 Answers0