How to use CreateItemAsync to add an item with a list to an Azure gremlin DB

217 views Asked by At

I am new to Azure Gremlin and I am trying to insert an item to the database that includes a list using Container.CreateItemAsync with Microsoft.Azure.Cosmo in C#.

Reading around I tried this. First, I have a class.

public class MyItem
{
    [JsonProperty(PropertyName = "id")]
    public string Id { get; set; }

    [JsonProperty(PropertyName = "myList")]
    public List<string> MyList { get; set; }
}

Then I run

MyItem item = new MyItem
{
    Id = "myItemId",
    MyList = new List<string> { "value1", "value2", "value3" }
};

container.CreateItemAsync(item);

This creates a new item in the database but completely ignores the list. I don't want to insert the list as text but rather as a property that holds an actual list.

Does anyone know how to do this?

Thanks.

1

There are 1 answers

1
Shridhara Pradhan On

You used to debug getter setter which proper command. Try using collection class