GithubHelp home page GithubHelp logo

Comments (10)

moh-hassan avatar moh-hassan commented on June 3, 2024

Can I know what the info you need?
It may be available in the API, so you can use it.

from odata2poco.

darinvanatta avatar darinvanatta commented on June 3, 2024

Thanks for your help!
Right now I just want to get entity names, entity elements and data types like you are doing for POCO class.

Here I'm getting the entity name but I can get the element names and their data types though I see in the debugger where they are in the image below. The debugger image shows the path to the element data types starting with "entity.Type.ElementType" but Intellisense shows "ElementType" is not an option though I see it in the debugger image.

image

image

from odata2poco.

moh-hassan avatar moh-hassan commented on June 3, 2024

You can get the metadata as given below:

            var o2p = new O2P(setting);
            var code = await o2p.GenerateAsync(connString);
            //generate metadata as xml file
	string metaData = o2p.MetaDataAsString;

from odata2poco.

darinvanatta avatar darinvanatta commented on June 3, 2024

Perfect! Is there an easy way to get into an object to iterate?

I'm running the demo and getting these errors which I didn't get last time?

image

from odata2poco.

moh-hassan avatar moh-hassan commented on June 3, 2024

These aren't errors, but log messages because the EntityName/ propertyName is a reserved c# keyword or the name of the property is the same name as its class type which causes the compiler error CS0542
e.g.,the message:

Rename the property 'Applicant.Applicant' to 'applicant' for avoiding the Compiler error CS0542

The message means that the property 'Applicant' in the class 'Applicant' is renamed to 'applicant' (lowercase) to avoid the compilation error CS0542

O2pgen rename the entity/property and show these messages during the generation, so you can avoid the compilation errors you get in your issue #12.

These information are very important when you retrieve data from Odata feeds using the generated POCO with Odata client tools and it's better to save these log messages.

In the next release, I can control show/hide these messages by an option or saving to log file.

from odata2poco.

moh-hassan avatar moh-hassan commented on June 3, 2024

Hi @darinvanatta
You can download a new version 3.2.0 from github

  • The warning are hided with the option --show-warning to show.
  • All renamed properties have an attribute JsonProperty, because Odata is case sensitive for the name of the properties/classes otherwise you get null values for these properties, example:
    [JsonProperty("Applicant")]
    public virtual string applicant {get;set;}

Try to reterive Applicant Entity and be sure that applicant property is not null.

I appreciate your feedback

from odata2poco.

darinvanatta avatar darinvanatta commented on June 3, 2024

Looks good! Thanks

image

from odata2poco.

moh-hassan avatar moh-hassan commented on June 3, 2024

Thanks @darinvanatta for feedback.
I suggest you generate a separate class library for the POCO classes and reference it in your project.
You can benefit from Linq and reflection and utilize the code as your needs.

from odata2poco.

darinvanatta avatar darinvanatta commented on June 3, 2024

Reflection on a class library works exactly as I need... Thanks!

from odata2poco.

moh-hassan avatar moh-hassan commented on June 3, 2024

A new version 3.2.0.7 including fix to this issue can be downloaded from github

from odata2poco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.