Skip to main content

Notifications

Finance forum
Answered

oData client

Posted on by 339

Hello,

has anyone successfully used an oData client recently ?

in the past I have successfully used the v4 oData client code generator to create the client :

https://marketplace.visualstudio.com/items?itemName=bingl.ODatav4ClientCodeGenerator

It appears that nowadays in 10.0.5 PU29, the entity metadata has grown so much that Visual Studio can't even 

create the client file anymore. I had to remove ten thousands of lines in the GenerateEdmModel class just to be

able to compile ODataClient.cs. As a result, it does not work properly, probably because of the missing metadata.

Following the pattern below, I'm running into errors such as {"Length cannot be less than zero.\r\nParameter name: length"}

for instance for code that used to run successfully (https://github.com/microsoft/Dynamics-AX-Integration)

private abstract class GeneratedEdmModel
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "7.5.1")]
private static global::Microsoft.OData.Edm.IEdmModel ParsedModel = LoadModelFromString();
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "7.5.1")]
private const string Edmx = @"<edmx:Edmx Version=""4.0"" xmlns:edmx=""">">docs.oasis-open.org/.../edmx"">

<edmx:DataServices>

<Schema Namespace=""Microsoft.Dynamics.DataEntities"" xmlns=""">">docs.oasis-open.org/.../edm"">
<EntityType Name=""ElectronicPaymentType"">
<Key>
<PropertyRef Name=""PaymentType"" />
<PropertyRef Name=""dataAreaId"" />
</Key>

Question is, am I doing something wrong or someone else experiencing the same ? And is there a work around or

alternative ?

Categories:
  • Verified answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,645 Moderator on at
    RE: oData client

    You can also user solution provided in the below link to trim the metadata

    github.com/.../EDMXTrimmer

  • Suggested answer
    Frank Bruemmer Profile Picture
    Frank Bruemmer 339 on at
    RE: oData client

    Thanks, what version are you on ? I can get this to work with the original oDataClient.cs (~45MB) that comes with the integration examples and I was able to generate code for the metadata pulled from my client's instance a while ago. Generating a client from 10.0.5 PU29 resulted in a file large than 64MB based of ~20MB of metadata. And this is without any custom data entities so far. We will have custom data entities soon, and this will be a problem.

  • Pedro Tornich Profile Picture
    Pedro Tornich 955 on at
    RE: oData client

    I suggest you create a new issue in the OData Client github page:

    https://github.com/OData/odata.net/issues

    PS: I've never had problems with the OData Client.

  • Suggested answer
    Frank Bruemmer Profile Picture
    Frank Bruemmer 339 on at
    RE: oData client

    So, it appears that the only way to make this work is to crop entities from the metadata that are not needed for the client. I wish there would be a generator where you could select a number of data entities to be generated.

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Waed Ayyad!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 289,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 227,174 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans