This project has moved and is read-only. For the latest updates, please go here.

Storing collections

Mar 20, 2015 at 2:40 AM
I'm experimenting with nonSQL databases and BrightstarDB. I'm trying to create a sample ordering database.

I created an order details class:
    public interface IOrderItem
        string Id { get; }

        string prodDescription { get; set; }
        string prodSKU { get; set; }
        int prodQuantity { get; set; }
and I tried to create an order class:
    public interface IOrder
        string Id { get; }

        Guid customerID { get; set; }
        Guid orderID { get; set; }
        string orderNumber { get; set; }
        DateTime orderDate { get; set; }

        List<IOrderItem> orderItems:
But, when I do "Run Custom Tool" on the file, I get this error message:

Running transformation: Invalid property: MyTest.IOrder.orderItems - the property type System.Collections.Generic.List<MyTest.IOrderItem> is not supported by Entity Framework.

If I comment out the List property from IOrder, the error goes away, so it's obviously associated with my attempt to declare the list.

I haven't been able to find any postings that talks about how to include a collection in an object in BrightstarDB.

I suppose I could include the orderID in IOrderItem and store the individual IOrderItem records separately from the parent IOrder record. Is this the approach I need to take? I would appreciate if someone can help enlighten me as to the right approach to take.


Mar 20, 2015 at 11:34 AM
You just need to declare your collection as an ICollection<T> rather than as a List<T> - the generated code will implement the ICollection interface.

Take a look at for more information and other data patterns.

Hope this helps!

Marked as answer by rrosenheim on 3/24/2015 at 4:27 PM
Mar 25, 2015 at 12:27 AM
Thanks! That was the trick. I tried IList, but never thought of using ICollection.