locked
Loading a Collection(Edm.String) into an EdmEntityType RRS feed

  • Question

  • Hello,

    I am passing an OData string into a C# app. This OData string includes a query that is intended to be used against a Collection(Edm.String). I need to parse out that query into an EdmModel. Currently, I have the following:

    private void LoadODataModel(List<Schema> fields, out IEdmModel model, out IEdmType type)
    {
      var dataType = new EdmEntityType("Org", "Query");
      foreach (var field in fields)
      {
        if (field.IsStringCollection)
        {
          // TODO: Search collections
        }
        else
        {                        dataType.AddStructuralProperty(field.Name, field.GetPrimitiveType());
        }
      }
    
      model = new EdmModel();
      type = dataType;
    }
    

    My problem is, I do not know how to add a property that represents a Collection(Edm.String) to an EdmEntityType. How does one do this?

    Thank you!

    Tuesday, March 10, 2015 6:14 PM

All replies

  • Can you provide a data sample?

    jdweng

    Tuesday, March 10, 2015 9:15 PM
  • What kind of data sample are you looking for? 

    The Collection(Edm.String) looks like the following:

    Chicago
    Denver
    Portland
    Seattle
    Is there some other type of data you're looking for. I'm really stuck on this one.

    Tuesday, March 31, 2015 12:39 PM
  • You could return a CSV string which is easy to split.

    "Chicago,Denver,Portland,Seattle"


    jdweng

    Tuesday, March 31, 2015 12:50 PM