views:

38

answers:

1

Given that I've got any number of controllers, how should they access the data saved in the model?

  • In a database driven application it's quite easy as all data can be fetched from one single object.

  • Should there be a namespace / singleton / global object which allows access to the data?

  • Should the model be passed to all controllers when they are created?
+1  A: 

Some of the best practice being pass around is setting up a repository pattern like so within your model to abstract the data model form data mapping. I'd go into more detail but the first link gets you there.

RailRhoad
This is just the first approach that I've listed.
Georg