cheap oakleys replica michael kors bags cheap christian louboutin online elite jerseys wholesale cheap nfl jerseys discount ray bans cheap michael kors cheap ray bans replica oakleys wholesale replica michael kors wholesale oakley sunglasses cheap fake ray bans cheap jerseys china cheap christian louboutin outlet fake cheap oakleys cheap oakleys cheap jerseys sale cheap christian louboutin discount oakleys wholesale nfl jerseys cheap michael kors handbags michael kors handbags discount christian louboutin cheap jerseys michael kors on sale discount ray bans wholesale jerseys cheap michael kors fake oakleys online cheap michael kors bags replica ray bans discount ray bans authentic jerseys cheap christian louboutin cheap oakleys cheap oakleys outlet nfl jerseys red bottoms shoes on sale cheap ray bans cheap nfl jerseys cheap replica oakleys michael kors on sale cheap christian louboutin outlet Cheap Elite Jerseys cheap michael kors cheap ray bans cheap jerseys free shopping cheap fake oakleys cheap oakleys sale cheap michael kors outlet ray bans shop fake cheap oakleys cheap authentic nike jerseys christian louboutin online fake cheap oakleys fake oakleys store cheap jerseys wholesale cheap christian louboutin replica oakleys cheap jerseys wholesale cheap replica oakleys michael kors handbags wholesale jerseys china discount nhl jerseys wholesale replica michael kors cheap ray bans cheap jerseys cheap fake oakleys fake oakleys cheap michael kors store cheap ray bans wholesale oakleys jerseys wholesale christian louboutin outlet cheap mlb jerseys oakley sunglasses authentic jerseys christian louboutin outlet cheap replica oakleys wholesale authentic jerseys wholesale mlb jerseys michael kors handbags cheap jerseys online shopping cheap nhl jerseys michael kors bags cheap fake oakleys cheap jerseys from china cheap fake oakleys 2016 cheap fake oakleys cheap michael kors cheap discount ray bans fake cheap oakleys cheap jerseys free shopping cheap christian louboutin online wholesale nfl jerseys cheap jerseys from china wholesale christian louboutin wholesale mlb jerseys official jerseys fake cheap oakleys cheap michael kors handbags wholesale jerseys cheap wholesale jerseys cheap fake oakleys oakley sunglasses cheap discount oakleys oakleys sunglasses usa cheap michael kors online wholesale and retail oakleys cheap michael kors outlet cheap wholesale jerseys wholesale cheap jerseys china cheap replica oakleys fake oakleys online authentic jerseys wholesale ray bans fake cheap oakleys jerseys wholesale replica ray bans wholesale sunglasses wholesale mlb jerseys cheap cheap nfl jerseys cheap michael kors outlet cheap fake ray bans cheap oakleys sale cheap fake ray bans oakleys sunglasses michael kors bags fake cheap oakleys fake cheap oakleys authentic wholesale jerseys nhl jerseys cheap michael kors outlet cheap oakleys online wholesale jerseys fake ray bans online store michael kors handbags outlet wholesale jerseys china fake ray bans ray bans outlet cheap christian louboutin cheap nba jerseys cheap ray bans cheap ray bans wholesale nfl jerseys wholesale sunglasses michael kors bags outlet cheap ray bans on sale fake cheap oakleys cheap nfl jerseys cheap nhl jerseys cheap oakleys cheap jerseys cheap fake oakleys michael kors outlet cheap jerseys store fake ray bans christian louboutin shoes discount nba jerseys michael kors for sale cheap fake oakleys fake ray bans sunglasses cheap michael kors handbags oakley sunglasses michael kors handbags michael kors on sale fake cheap oakleys cheap nfl jerseys replica oakleys cheap oakleys outlet cheap oakleys cheap authentic nfl jerseys paypal cheap fake oakley sunglasses cheap oakleys cheap jerseys paypal
Inder Singh's Blog » Page 2
Mar 072009

I have been reading Michele Bustamante’s Learning WCF. Its a very well-written book and the best part is that its written in a Tutorial style with plenty of labs to give hands-on experience otherwise it kind of gets boring to do plain reading. I am learning WCF on my own and not using it on a real project so I am finding this book to be very useful. This book was originally written for WCF released as part of .NET Framework 3.0 targeting Visual Studio 2005, there has been a reprint of the book as well as the accompanying code has been updated for .NET Framework 3.5 and Visual Studio 2008. With the ever changing world of technology, things get outdated pretty quickly hence I am also finding things here and there which have changed. Yesterday, I spent a few hours researching an issue related to DataContract where the code did not behave as expected so I thought I should write a quick post about my learning.


Let’s look at a simple ServiceContract:

interface IEmployeeService
   Employee GetEmployeeDetails(int employeeID);

The Employee class:

public class Employee
  private int _ID;
  private string _FirstName;
  private string _LastName;
  private string _Title;

  public int ID
     get { return this._ID;  }
     set { this._ID = value;

  public string FirstName 
     get { return this._FirstName; }
     set { this._FirstName = value; }

  public string LastName
     get { return this._LastName; }
     set { this._LastName = value; }

  public string Title
     get { return this._Title; }
     set { this._Title = value; }

In versions prior to .NET Framework 3.5 SP1, an InvalidDataContractException was thrown if an attempt was made to host this service because WCF required any parameters/return types in the ServiceContract (other then simple types like int, decimal, string, etc.) to be explicitly marked serialiable either by using a DataContract or some other mean. Now, with .NET Framework 3.5 SP1 this is no more a requirement, any type not marked as seriailizable is by default serilized using DataContractSerializer. A few points to note about this default serializion for types:

  • The class must have a default constructor(parameterless constructor).
  • Only public read/write properties are serialized.
  • If the class is marked as DataContract then the normal rules apply i.e. only members marked with DataMember attribute are serialized.

One benefit resulting from this feature is that if you are exposing types defined in an existing assembly through WCF services, you don’t need to make any changes to the existing type they will be automically be serialized for you whereas earlier there is was need to come up with a workaround like create surrogate types.
I was not able to find this change easily so thought I should write this post, hope this helps.

I have learnt quite a few other quirks related to WCF and LINQ and will be writing more posts as the time permits.

 Posted by on March 7, 2009