locked
Complex Type with a property of collection type RRS feed

  • Question

  • So basically I want to create a complex type with a property of a type of collection of entitytype. Something in the line of

    public class ComplexOrder
    {
    	public DateTime Created{get;set;}
    	public ObservableCollection<OrderLine> OrderLines{get;set;}
    }
    
    Given that OrderLine is an EntityType, is this even possible? With the builtin tools in VS2010, I can only get properties to be basic types. Eventually I want to return a collection of ComplexOrder from a service operation of a WCF Data Service, but I think that will solve itself if I can get the complex type to work.

    Tuesday, January 11, 2011 1:52 PM

All replies

  • Hi,

    Complex types cannot contain any entity type property.  Complex types can contain complex properties however.  Any reason why Order is not an entity type?

    -J

    Wednesday, January 12, 2011 2:11 AM
  • It's just an example to indicate what I want to do. "Order" is an enitytype, but it's not directly linked to "OrderLines" in the real world example. There's like 3-4 tables between them. "OrderLine" can be linked back to an "Order" and expressed as an collection there, hence I wanted to create a complex type like that. From what I understand, I need to create either a view to express this, or some sort of complex type that is a tuple of OrderId and OrderLineId?
    Thursday, January 13, 2011 9:46 AM