Reputation: 1841
Is there any advisable way to persist lazy loading from a REST api? When using NHibernate you have the option of lazy loading so that if you have a "Person" object that contains a collection of "Address" objects then that collection wont be loaded from the database until the point of it being accessed.
However if you return a Json object representing a Person is there an established way to return a reference to the REST resource so that when Person.Addresses is accessed that it makes the REST call to the appropriate URI and returns the appropriate data?
Upvotes: 0
Views: 716
Reputation: 2878
The concept you are looking for is Hypermedia. So your Person would have links to Addresses.
Here is a good video to explain Hypermedia APIs http://oredev.org/2010/sessions/hypermedia-apis
You'll have to pick a Media Type that supports this.
Upvotes: 1