Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

oData client

(0) ShareShare
ReportReport
Posted on by 345

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 ?

  • Verified answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,671 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 345 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 345 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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,684 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,414 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans