Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in the process of designing RESTful web services and got stuck at one point. The design is very simple with 3 entities:

- Project
- Status
- Employee

The part I am having trouble with is capturing the relationships:

- A project has a current status (1 to 1 between Project and Status).
- A project has multiple 'possible subsequent status' (1 to many between Project and Status).

The Visual Studio designer does not allow these two different relationships to be defined between these two entities. I am aware that it is just a modelling tool but at the same time, I am willing to know if this is the right approach.

Also, with this design, I am not sure how to access the Status entities using these two relationships.

http://serviceRootURL/Project(2)?$expand=Status // For current status
http://serviceRootURL/Project(2)?$expand=SubsequentStatus // For subsequent status

Is it possible to use arbitrary relationship names with the expand keyword?

(The question probably touches OData a little bit as well since I am trying to make my library OData-compliant.)

share|improve this question
up vote 1 down vote accepted

In VS 2012 Express, I was able to model two relationships between the same entities separately in an EDMX model. By selecting the relationship in the canvas, you can use the property pane on the right to give them different names and cardinalities. Also pay attention to the parent property name (in the pane, it's the "End2 Navigation Property").

Having modeled the relationships and exposed the model through OData, you can use the OData $expand option with the name of the relationship (like what you showed) to embed the related entities in the response to parent entities.

share|improve this answer

Do the current 'possible subsequent status' only depend on the current project status?

If yes then you could also model the possible status values as an entity with 1 occurence per status value. This would cause a change in the relationship between project and status to n:1 (a status can have any number of projects).

Add another recursive relationship "possible subsequent status" from status to status with a cardinality of 1:n.

Nice side effect of this is that you can easily list the projects with a particular status by starting with the status and following the relationship to the projects :-)

Don't know how well this can be modeled in VS or expressed in REST, sorry. But that would seem like a good model to me.

share|improve this answer

As in Domain Driven Design, it is possible to qualify the relationship wrt time? Then for a particular time period, you will have one-to-one relationship between Project and Status. Hence, you can define only one relationship?

Sorry, no clue about REST at all

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.