Activation Models in Remoting in C#.Net

In this post, we will discuss what is 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 the execution of Remoting, application client needs an object of the remote class to invoke the method under it. Activation Models decide where the remote class objects reside 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 the remote class. In the 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 the remote class gets created and it’s reference is given to the client. From then every new request coming from a new client, the server provides the reference of the same object which is alredy created , so changes made by one client gets reflected to the other. This is used in the development of an 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 the 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 a 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 the 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.

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply