header image

Tutorial Windows Communication Foundation (WCF) – Understanding Contract’s Attributes

Posted by: | January 14, 2009 | No Comment |

ServiceContractAttribute 

  • Name  and Namespace – The name and namespace of the contract in the WSDL <portType> element we can modify by specifying this two attribute. Default name is same as the contract type and http://tempuri.org. It is always recommondable to use Namespace to specify proper namespace which remove the conflict of the datatype/contract.
  • CallbackContract – It is used to mention the return contract in a two-way (duplex) conversation.
  • HasProtectionLevel and ProtectionLevel – Specifies whether all messages supporting the contract have a explicit ProtectionLevel value.
    Default ProtectionLevel is ProtectionLevel.None.
  • ConfigurationName – The name of the service element in the configuration file to use.
  • SessionMode – This is to specify whether the contract requires a binding that supports sessions.

Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx

OperationContractAttribute
Name: The name of an operation is part of a service contract. Default is the method name.
Action
ReplyAction
IsOneWay
ProtectionLevel
IsInitiating
IsTerminating
AsyncPattern: To asynchronously using a Begin/End method pair
Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.aspx

DataContractAttribute 
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx

DataMemberAttribute 
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute.aspx

MessageContractAttribute
IsWrapped
ProtectionLevel
WrapperName
WrapperNamespace
Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.messagecontractattribute.aspx

MessageHeaderAttribute
Name
Namespace
ProtectionLevel
Actor
MustUnderstand
Relay
Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.messageheaderattribute.aspx

MessageBodyMemberAttribute
Name
Namespace
ProtectionLevel
Order
Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.messagebodymemberattribute.aspx

FaultContract
Ref: http://msdn.microsoft.com/en-us/library/system.servicemodel.faultcontractattribute.aspx

under: 9534, 9536, 9541