views:

31

answers:

0

I have a custom .Net DataService and can't figure out how to return the data for relationships.

The data base has 2 tables (Customer, Address). A Customer can have multiple addresses, but each address can only have on customer.

I'm using Dictionary<string,object> as my data type.

My question, for the following 2 urls how do i return the data.

http://localhost/DataService/Customer(1)/Address

http://localhost/DataService/Address(1)/Customer

For the none relational queries I return a List<Dictionary<string,object>>

So I imagined for the relation I should just populate the element with a either a Dictionary<string,object> for the single ones and a List<Dictionary<string,object>> for many relationships.

customer["Address"] = new List<Dictionary<string,object>>();

address["Customer"] = new Dictionary<string,object>();

But this just gives me a NullRefferenceException

So what am I doing wrong?