Notes about WCF

A data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged.

Data contract can be explicit or implicit. Simple type such as int, string etc has an implicit data contract. User defined object are explicit or Complex type, for which you have to define a Data contract using [DataContract] and [DataMember] attribute.



Windows Communication Foundation (WCF) uses a serialization engine called the Data Contract Serializer by default to serialize and deserialize data (convert it to and from XML). All .NET Framework primitive types, such as integers and strings, as well as certain types treated as primitives, such as DateTime and XmlElement, can be serialized with no other preparation and are considered as having default data contracts. Many .NET Framework types also have existing data contracts. For a full list of serializable types, see Types Supported by the Data Contract Serializer.

New complex types that you create must have a data contract defined for them to be serializable. By default, the DataContractSerializer infers the data contract and serializes all publicly visible types. All public read/write properties and fields of the type are serialized. You can opt out members from serialization by using the IgnoreDataMemberAttribute. You can also explicitly create a data contract by using DataContractAttribute and DataMemberAttribute attributes. This is normally done by applying the DataContractAttribute attribute to the type. This attribute can be applied to classes, structures, and enumerations. The DataMemberAttribute attribute must then be applied to each member of the data contract type to indicate that it is a data member, that is, it should be serialized. For more information, see Serializable Types.


http://www.dotnetspider.com/forum/287974-What-DataContract-WCF.aspx

Wcf Linq Serialization Error

An error occurred while receiving the HTTP response to http://localhost:8732/Design_Time_Addresses/WcfServiceLibraryTest/GenreService/.
This could be due to the service endpoint binding not using the HTTP protocol.
This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down).
See server logs for more details.

There was an error while trying to serialize parameter http://tempuri.org/:ListGenresResult.
The InnerException message was 'Object graph for type 'System.Data.Linq.EntitySet`1[[DataLayer.Musician, DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' contains cycles and cannot be serialized if reference tracking is disabled.'.

Solution:
Serialization Mode : Unidirectional (dbml file)

WCF Logging:
http://msdn.microsoft.com/en-us/library/ms732009.aspx
http://msdn.microsoft.com/en-us/library/ms730064.aspx

search this blog (most likely not here)