In this post we will discuss about what are activation model in remoting in C#.Net. Also you can check out my previous posts on:
.NET Remoting is a mechanism for communicating between objects which are not in the same process that means in Remoting we can consume assemblies residing on remote machines.For execution of Remoting application client needs object of remote class to invoke the method under it. Activation Models decide where the remote class objects resides in the execution of the applications.
Remoting supports 2 different Activation Models:
1. Server Activated Objects(SAO)
2. Client Activated Objects(CAO)
Server Activated Objects:
In SAO model object of remote class resides on server Machine and a reference of this object is maintained on the client machine using which clients can invoke the methods of remote class.In SAO model again 2 types of object mode required for server activation. This can be Singleton or SingleCall .
a. Singleton-> In this mode whenever a first request comes from a client,an object of remote class gets created and it’s reference is given to the client.From then every new request coming from a new client,server provides the reference of same object which is alredy created ,so changes made by one client gets reflected to the other.This is used in the development of application like, “cricket score”,”public chats” etc. A Singleton, on the other hand, only gets one instance created for ALL incoming requests. Singleton builds a single object to handle multiple calls allowing data sharing, but limits simultaneous connections
b. Singlecall-> In this mode whenever a request comes from a client one object of remote class gets created and its reference is given to the client.Once the request is served immediately object gets destroyed without allowing to make other request on that object.For a new request a new object gets created again and destroyed.This is used in the development of single request application like,”ATM Machines”,”Railway PNR status enquiry” and “Examination Results”. This is very highly secured model used in application development. SingleCall builds the object per each call and can accept multiple simultaneous requests, but data can’t be shared between calls.Single Call objects are usually not required to store state information, and they cannot hold state information between method calls.
Client Activated Objects(CAO):
Client-activated objects (CAO) are server-side objects that are activated upon request from the client. In this mode whenever the first request comes from a client an object of remote class is created and provided,using which the client can make any no.of requests.Here a separate object will be given for each client so changes made by one client will never reflect to the other.This is used in the development of applications that requires multiple requests for a single client like “Traditional ATM machines”,where we can perform multiple transactions once we insert the card.Client-activated objects can store state information between method calls for its specific client, and not across different client objects.
Similar SharePoint 2013 Tutorials