In Breeze, each of the objects would be handled as either an Entity (if it has an identifier) or a Complex Type (if it does not). In your case, I've made Entites for "Customer" (the top level object), "Order", and "OrderItem". I've made a ComplexType for "Address".
Note that each incoming object should have a "$type" property to tell Breeze what Entity Type or Complex Type it is. Without that, you'll need a custom [JsonResultsAdapter] to tell Breeze the type.
My metadata differs from your objects in that I've assumed that foreign keys are available to connect Customer to Order to OrderItem and vice-versa. That makes the entities easier to work with, but you should omit them from the metadata if your server cannot provide them.
{
"structuralTypes": [
{
"shortName": "Address",
"namespace": "MyApp",
"isComplexType": true,
"dataProperties": [
{
"name": "city",
"dataType": "String",
"maxLength": 15
},
{
"name": "state",
"dataType": "String",
"maxLength": 15
}
]
},
{
"shortName": "Customer",
"namespace": "MyApp",
"autoGeneratedKeyType": "KeyGenerator",
"defaultResourceName": "Customers",
"dataProperties": [
{
"name": "id",
"dataType": "Guid",
"isNullable": false,
"isPartOfKey": true
},
{
"name": "name",
"dataType": "String",
"maxLength": 30
},
{
"name": "location",
"complexTypeName": "Address:#MyApp"
}
],
"navigationProperties": [
{
"name": "orders",
"entityTypeName": "Order:#MyApp",
"isScalar": false,
"associationName": "AN_Customer_Order"
}
]
},
{
"shortName": "Order",
"namespace": "MyApp",
"autoGeneratedKeyType": "Identity",
"defaultResourceName": "Orders",
"dataProperties": [
{
"name": "id",
"dataType": "Guid",
"isNullable": false,
"isPartOfKey": true
},
{
"name": "customerID",
"dataType": "Guid"
},
{
"name": "date",
"dataType": "DateTime"
}
],
"navigationProperties": [
{
"name": "customer",
"entityTypeName": "Customer:#MyApp",
"isScalar": true,
"associationName": "AN_Customer_Order",
"foreignKeyNames": [
"customerID"
]
},
{
"name": "items",
"entityTypeName": "OrderItem:#MyApp",
"isScalar": false,
"associationName": "AN_Order_OrderItem"
}
]
},
{
"shortName": "OrderItem",
"namespace": "MyApp",
"autoGeneratedKeyType": "None",
"defaultResourceName": "OrderItems",
"dataProperties": [
{
"name": "id",
"dataType": "Guid",
"isNullable": false,
"isPartOfKey": true
},
{
"name": "orderID",
"dataType": "Guid",
"isNullable": false
},
{
"name": "description",
"dataType": "String",
"isNullable": false
},
{
"name": "price",
"dataType": "Decimal",
"isNullable": false
}
],
"navigationProperties": [
{
"name": "order",
"entityTypeName": "Order:#MyApp",
"isScalar": true,
"associationName": "AN_Order_OrderItem",
"foreignKeyNames": [
"orderID"
]
}
]
}
],
"resourceEntityTypeMap": {
"Customers": "Customer:#MyApp",
"Orders": "Order:#MyApp",
"OrderItems": "OrderItem:#MyApp"
}
}