Thursday, April 28, 2011

WCF Notes

Instance Management

WCF supports three types of instance activation: per-call/Sessionful/singleton service.

[ServiceContract]
interface IMyContract
{...}

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
class MyService : IMyContract
{...}


Operations



WCF supports three invocation model: Request-Reply/One-Way/Callback.



[ServiceContract]
interface IMyContract
{
[OperationContract(IsOneWay = true)]
void MyMethod( );
}


[ServiceContract(CallbackContract = typeof(ISomeCallbackContract))]
interface IMyContract
{
[OperationContract]
void DoSomething( );
}


Fault Contracts



The client can actually encounter three types of errors when trying to invoke the service: communication errors, errors related to the state of the proxy, service-thrown exceptions.



By default, any exception thrown by the service reaches the client as a FaultException.



Transactions



Transaction Flow: Allowed, NotAllowed, Mandatory.



Transaction Protocols



Transaction management protocols: Lightweight, OleTx(RPC), WS-Atomic Transaction (WSAT).



Transaction Managers



The three transaction managers are the Lightweight Transaction Manager (LTM), the Kernel Transaction Manager (KTM), and the Distributed Transaction Coordinator (DTC).

No comments: