Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:29:48+00:00 2026-05-24T21:29:48+00:00

I am writing some code against the Azure Table Storage REST API. The API

  • 0

I am writing some code against the Azure Table Storage REST API. The API uses OData, which is normally handled by the .net client. However, I am not using the client, so I need to figure out another way to generate/consume OData XML. I can use the Syndication classes to do the ATOM stuff, but not the OData/EDM <-> CLR mapping.

Is anyone aware of a OData/EDM <-> type mapper, and/or CLR object to OData entity converter?

Thanks,
Erick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:29:52+00:00Added an answer on May 24, 2026 at 9:29 pm

    Here’s some code that converts an XML element (from an OData feed) and converts it to an ExpandoObject.

    private static object GetTypedEdmValue(string type, string value, bool isnull)
    {
        if (isnull) return null;
    
        if (string.IsNullOrEmpty(type)) return value;
    
        switch (type)
        {
            case "Edm.String": return value;
            case "Edm.Byte": return Convert.ChangeType(value, typeof(byte));
            case "Edm.SByte": return Convert.ChangeType(value, typeof(sbyte));
            case "Edm.Int16": return Convert.ChangeType(value, typeof(short));
            case "Edm.Int32": return Convert.ChangeType(value, typeof(int));
            case "Edm.Int64": return Convert.ChangeType(value, typeof(long));
            case "Edm.Double": return Convert.ChangeType(value, typeof(double));
            case "Edm.Single": return Convert.ChangeType(value, typeof(float));
            case "Edm.Boolean": return Convert.ChangeType(value, typeof(bool));
            case "Edm.Decimal": return Convert.ChangeType(value, typeof(decimal));
            case "Edm.DateTime": return XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.RoundtripKind);
            case "Edm.Binary": return Convert.FromBase64String(value);
            case "Edm.Guid": return new Guid(value);
    
            default: throw new NotSupportedException("Not supported type " + type);
        }
    }
    
    private static ExpandoObject EntryToExpandoObject(XElement entry)
    {
        XNamespace xmlnsm = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
                    xmlns = "http://www.w3.org/2005/Atom";
    
        ExpandoObject entity = new ExpandoObject();
        var dic = (IDictionary<string, object>)entity;
    
        foreach (var property in entry.Element(xmlns + "content").Element(xmlnsm + "properties").Elements())
        {
            var name = property.Name.LocalName;
            var type = property.Attribute(xmlnsm + "type") != null ? property.Attribute(xmlnsm + "type").Value : "Edm.String";
            var isNull = property.Attribute(xmlnsm + "null") != null && string.Equals("true", property.Attribute(xmlnsm + "null").Value, StringComparison.OrdinalIgnoreCase);
            var value = property.Value;
    
            dic[name] = GetTypedEdmValue(type, value, isNull);
        }
    
        return entity;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some code against a C++ API that takes vectors of vectors of
I'm writing some code for a class constructor which loops through all the properties
I'm writing some code that uses dynamic shared libraries as plugins. My command line
I'm writing some code that needs to work against an array of different database
I'm writing some code that does date and time calculations against the current time.
I am writing some code to determine whether a network domain is registered. For
So I was writing some code today that basically looks like this: string returnString
I am writing some code and trying to speed it up using SIMD intrinsics
I'm writing some code in python and I'm having trouble when trying to retrieve
I'm writing some code that id like to be able to work with any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.