microsoft / Dynamics-AX-Integration

Dynamics AX Integration samples and demos.
286 stars 356 forks source link

Dynamic generation of oDataClient code #72

Open francisharvey opened 5 years ago

francisharvey commented 5 years ago

After changing .NET target to 4.6.1, using TLS1.2, removing misplaced space in the metadata document and renaming duplicated entity names to allow generation to work in Visual studio, here's where I stand now.

1 - The template generated oDataClient cause crashes in Visual studio and it needs to be regenerated manually.

2 - Automation of the template generation using ITextTemplatingEngineHost does not work well, it gives an empty path exception in .NET code.

3 - Usage of EntityClassGenerator returns this error "The required attribute 'Relationship' is missing." Since It works for the Dynamics NAV oData endpoint, I was under the impression this was the best way to generate the oDataClient code. I'm still not sure if it supports latest oData version...

I read somewhere that the DAX365 metadata may be broken, it is the case?

So I don't know what else to try, Any suggestions would be appreciated.

Thanks a lot!

srpraveenkumar commented 5 years ago

Hi Francis,

Could you consider try generating OData client on VS 2015 using https://github.com/batetech/D365FO-oData-T4-MultiFile-Templates?

This modification allows for T4 file to be generated in multiple files. VS is able to handle multiple files better than one long file.

Thanks,

francisharvey commented 5 years ago

Hi Praveen, I will try it with VS first and then with the templating automation.

Still, any dynamic approach will better fit my needs, it will not be possible for me to rely on visual studio for this. Do you have some insight on the EntityClassGenerator?

Thank you!

francisharvey commented 5 years ago

Just to let you know that the crashing of VS is due to the Edmx property in your template, it also blocks compilation because it reaches the literal string length limit allowed by the compiler.

I'm not sure but I think the EntityClassGenerator only supports v1 and v2, so this may be why i'm getting the relationship error.

So I'm fallbacking to the templating automation, but your template seems to have problems with the Microsoft.VisualStudio.TextTemplating.Engine... I've opened another issue for this one.