Blog: Serialization

EF & WCF: Serialize not loaded collection navigation properties as null rather than an empty collection

April 25, 2013, (updated on September 8, 2014), Software Development

Sometimes a web service client wants to know if a collection navigation property (a navigation property with “many” references) of a received entity object has been loaded on the server (e.g. by using Entity Framework’s Include method). By default, not loaded collection navigation properties are serialized as empty collections (not null). This is why the client cannot differentiate between a not loaded property and an empty collection. In one of my projects, I needed to have this information to know if a property is already loaded or has to be lazy loaded using an additional web service call. A way […] Read more...

Tags: , , , ,

  Page 1 of 1