<p>I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup.</p>

<p>Any suggestions when taking this approach?</p>

<hr>

<p>when I implemented this technique and step into my app, just before the server returns my list it hits the get of each property that is supposed to be lazy loaded ... Thus eager loading. Could you explain this issue or suggest a resolution?</p>

<p>Edit:  It <a href="http://benders-blog.blogspot.com/2007/01/lazy-loading-in-soa-world.html" rel="nofollow noreferrer">appears</a> you can use the XMLIgnore attribute so it doesn’t get looked at during serialization .. still reading up on this though</p>

[{'answer_id': 36348, 'author': 'Jeremy McGee', 'author_id': 3546, 'author_profile': 'https://Stackoverflow.com/users/3546', 'pm_score': 3, 'selected': True, 'text': '<p>As for any remoting architecture, you\'ll want to avoid loading a full object graph "down the wire" in an uncontrolled way (unless you have a trivially small number of objects).</p>\n\n<p>The <a href="http://en.wikipedia.org/wiki/Lazy_loading" rel="nofollow noreferrer">Wikipedia article</a> has the standard techniques pretty much summarised (and in C#. too!). I\'ve used both ghosts and value holders and they work pretty well.</p>\n\n<p>To implement this kind of technique, make sure that you separate concerns strictly. On the server, your service contract implementation classes should be the only bits of the code that work with data contracts. On the client, the service access layer should be the only code that works with the proxies. </p>\n\n<p>Layering like this lets you adjust the way that the service is implemented relatively independently of the UI layers calling the service and the business tier that\'s being called. It also gives you half a chance of unit testing!</p>\n'}, {'answer_id': 38744, 'author': 'Ben Scheirman', 'author_id': 3381, 'author_profile': 'https://Stackoverflow.com/users/3381', 'pm_score': 2, 'selected': False, 'text': "<p>Don't do lazy loading over a service interface.  Define explicit DTO's and consume those as your data contracts in WCF.</p>\n\n<p>You can use NHibernate (or other ORMs) to properly fetch the objects you need to construct the DTOs.</p>\n"}, {'answer_id': 65766, 'author': 'noetic', 'author_id': 9198, 'author_profile': 'https://Stackoverflow.com/users/9198', 'pm_score': 1, 'selected': False, 'text': '<p>You could try to use something REST based (e.g. <a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" rel="nofollow noreferrer">ADO.NET Data Services</a>) and wrap it transpariently into your client code.</p>\n'}]
['https://Stackoverflow.com/questions/35560', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2701/']