SlideShare a Scribd company logo
1 of 66
Remoting
& Serialization
BY Chathurangi Shyalika
KDU-IT-Intake XXXI
Introduction
An Application domain, or AppDomain, is the smallest execution unit for a .NET
application.
The CLR allows several application domains to run within a single Windows process.
Distributed Applications enable communication between objects that run in different
application domains and processes.
System.Net, System.Runtime.Remoting and System.Web.Services namespaces
enable the .NET Framework to support distributed application development.
.NET Remoting
The System.Runtime.Remoting Namespace —This namespace includes the classes
that constitutes the .NET remoting framework.
The .NET remoting framework enables communication between objects living in
different Appdomains whether or not they are on the same computer.
Remoting provides an abstraction over the complexities of network programming and
exposes a simple mechanism for inter application domain communication.
The key objectives of .NET remoting are flexibility and extensibility.
Services
Object Activation
Object Lifetime Support
Communication Channels
Formatters
.NET Remoting layer revolves around a careful orchestration that takes place between
four key players:
• Proxies
• Messages
• Channels
• Formatters
Key Players
.NET Remoting Components
A remotable object: Which is an object that contain some properties and methods
located in one application domain and you need to call its methods or properties from
another application domain or process.
A host application (server application): The main task of this host is to listen to
requests for the hosted remotable object.
A client application: This is the application which makes requests for the remotable
object.
Types of Remotable Objects
There are 3 types of remotable objects that you can configure and choose from
depending on the requirements of your application.
 Single Call: Service one and only one request coming in
 Singleton Call: Service multiple clients and is useful when data needs to be shared
explicilty between several clients.
 Client Activation: Richer than singleton in many aspects as they can store the state
information between method calls for its specific client.
.NET Remoting Architecture
1. When a client object wants to create an
instance of the server object, the remoting
system at the client side instead creates a
proxy of the server object.
2. When the client object calls a method on the
server object, the proxy passes the call
information to the remoting system on the
client. This remoting system in turn sends the
call over the channel to the remoting system
on the server.
Cont.
3. The remoting system on the server receives the call
information and, on the basis of it, invokes the method
on the actual object on the server (creating the object if
necessary).
4. The remoting system on the server collects all the
results of the method invocation and passes them
through the channel to the remoting system on the
client.
5. The remoting system at the client receives the
response of the server and returns the results to the
client object through the proxy.
.Net Remoting Vs Web Services
XML Web Services:
• Simple, loosely coupled programming model.
• Can be accessed only over HTTP and work in a stateless environment.
• Services hosted in IIS.
.Net Remoting:
• Tightly coupled and more complex programming model.
• Can be accessed over any protocol and support both stateful and stateless
environments.
• Services hosted in any AppDomain.
Object Marshalling
Marshalling or Marshaling is the process of transforming the memory representation
of an objet to a data format suitable for storage or transmission.
Used when data must be moved between different parts of a computer program or from
one program to another.
Marshalling is similar to serialization and is used to communicate to remote objects with
an object, in this case a serialized object.
Cont.
It simplifies complex communication, using custom/complex objects to communicate
instead of primitives.
Marshalling is the process of packaging and unpackaging parameters so a remote
procedure call can take place.
Remotable objects are objects that can be marshalled across the application domains.
In contrast, all other objects are known as nonremotable objects.
Usage
Used within implementation of different remote procedure call mechanisms, where it is
necessary to transport data between processes and/or between threads.
In Microsoft's Component Object Model interface pointers must be marshalled when
crossing Component Object Model apartment boundaries.
Example
Marshaling an integer parameter involves simply copying the value into the message
buffer.
Marshaling an array is a more complex process. Array members are copied in a specific
order so that the other side can reconstruct the array exactly. When a pointer is
marshaled, the data that the pointer is pointing to is copied following rules and
conventions for dealing with nested pointers in structures. Unique functions exist to
handle the marshaling of each parameter type.
Types of Remotable Objects
Marshal-by-value (MBV) Objects — These objects are copied and passed out of the
server application domain to the client application domain.
Marshal-by-reference (MBR) Objects — These objects are accessed on the client
side using a proxy. The client just holds a reference to these objects.
Marshal-by-value (MBV) Objects
MBV objects reside on the server.
When the client invokes a method on the MBV object, the MBV object is serialized,
transferred over the network, and restored on the client as an exact copy of the server-side
object. The method is then invoked directly on the client. When this happens, the MBV object
is no longer a remote object. Any method calls to the object do not require any proxy object
or marshalling because the object is locally available.
The MBV objects can provide faster performance by reducing the number of network
roundtrips, but in the case of large objects, the time taken to transfer the serialized object
from the server to the client can be very significant.
MBV objects do not allow you the flexibility to run the remote object in the server
environment.
A MBV object can be created by declaring a class with the Serializable attribute.
Marshal-by-reference (MBR) Objects
They always reside on the server.
All methods invoked on these objects are executed at the server side.
The client communicates with the MBR object on the server using a local proxy object
that holds the reference to the MBR object.
Although the use of MBR objects increases the number of network roundtrips, they are
a good choice when the objects are prohibitively large or when the functionality of the
object is only available in the server environment on which it is created.
An MBR object can be created by deriving from the System.MarshalByRefObject
class.
Channels
Channel is an object that transports messages across remoting boundaries
Channels are responsible for passing messages across remoting boundaries.
Channels must be registered before `objects are created as per application domain.
A channel has two endpoints.
The channel object at the receiving end of a channel (the server) listens to a particular
protocol using the specified port number, whereas the channel object at the sending end
of the channel (the client) sends information to the receiving end using the protocol and
port number specified by the channel object on the receiving end.
The .NET Framework provides implementations for two channels.
 HTTP (Hypertext Transfer Protocol)
 TCP (Transmission Control Protocol) channels.
If you want to use a different protocol, you can define your own channel by
implementing the IChannelReceiver and IChannelSender interfaces.
HTTP Channels
HTTP channels use HTTP for establishing communication betweenthe two ends.
These channels are implemented through the classes of the
System.Runtime.Remoting.Channels.Http namespace.
The ChannelServices class is used to register a sender-receiver HTTP channel.
One of its static methods used there is RegisterChannel(), which helps in registering a
channel with the remoting framework.
The HTTP Channel Classes
CLASS INTERFACE PURPOSE
HttpServerChannel IChannelReceiver An implementation for a server channel
that uses the HTTP protocol to receive
messages
HttpClientChannel IChannelSender An implementation for a client channel
that uses the HTTP protocol to send
messages
HttpChannel IChannelReceiver
IChannelSender
An implementation of a combined and
channel that provides the functionality of
both the HttpServerChannel and the
HttpClientChannel classes
TCP Channels
A TCP channel uses TCP for establishing communication between the two ends.
The TCP channel is implemented through various classes of the
System.Runtime.Remoting.Channels.Tcp namespace.
The TCP Channel Classes
CLASS INTERFACE PURPOSE
TcpServerChannel IChannelReceiver An implementation for a server channel
that uses the TCP protocol to receive
messages
TcpClientChannel IChannelSender An implementation for a client channel
that uses the TCP protocol to send
messages
TcpChannel IChannelReceiver An implementation of a combined and
channel that provides the
IChannelSender functionality for both
the TcpServerChannel and
TcpClientChannel classes
Choosing Between HTTP Channel
and TCP Channels
Channel Scope Efficiency Security
HttpChannel Wide Less More
TcpChannel Narrow More Less
Formatters
The objects used to encode and serialize data into messages.
A formatter class must implement the IFormatter interface.
The .NET Framework packages two native formatter classes;
1. BinaryFormatter class
2. SoapFormatter class
The SOAP Formatter
SOAP - Simple Object Access Protocol
Straightforward, XML-based protocol for exchanging types and messages between
applications
An extensible and modular protocol
Implemented in the SoapFormatter class of the
System.Runtime.Serialization.Formatters.Soap namespace
The Binary Formatter
Can be understood only within .NET applications
Compact and efficient
Implemented in the BinaryFormatter class of the
System.Runtime.Serialization.Formatters.Binary namespace
Channels and Formatters
HTTP channel uses the SOAP formatter.
HTTP channel uses;
- SoapClientFormatterSinkProvider class
- SoapServerFormatterSinkProvider class
to serialize and deserialize messages
Can create industry-standard XML Web services
Cont.
TCP channel uses the binary formatter.
TCP channel uses;
- BinaryClientFormatterSinkProvider class
- BinaryServerFormatterSinkProvider class
to serialize and deserialize messages.
Cont.
Remote Object Activation and
Lifetime Leases
Remote Object Activation
Only MBR objects can be activated remotely.
No remote activation is needed for of MBV objects because
-the MBV object itself is transferred to the client side.
Based on the activation mode, an MBR object is classified into one of the following two
categories:
Server-activated objects
Client-activated objects
Remote Object
Activation
Server-Activated
Objects
SingleCall
activation mode
Client-Activated
Objects
Singleton
activation mode
Well-Known Objects
1. Server-Activated Objects
Server-activated objects (SAO) are those remote objects whose lifetime is directly
controlled by the server.
When a client requests an instance of a server-activated object, a proxy to the remote
object is created in the client’s application domain. The remote object is only instantiated (or
activated) on the server when the client calls a method on the proxy object.
Limited flexibility.
Two activation modes for a server-activated object:
1.SingleCall activation mode 2.Singleton activation mode
SingleCall Activation Mode
An object is instantiated for responding to just one client request.
After the request is fulfilled, the .NET remoting framework deletes the object and
reclaims its memory.
Also known as stateless because the objects are created and destroyed with each
client request; therefore, they do not maintain state across requests.
Allows for greater server scalability as an object consumes server resources only for a
small period, therefore allowing the server to allocate resources to other objects.
Examples of the SingleCall activation mode
Applications in which the object is required by the client to do a small amount of work and
then the object is no longer required.
retrieving the inventory level for an item
displaying tracking information for a shipment
Singleton Activation Mode
There is one instance of the remote object regardless of the number of clients accessing it.
Maintain state information across method calls.
Such objects are also sometimes known as Stateful objects.
Object is globally shared by all of its clients.
A Singleton object does not exist on the server forever.
Its lifetime is determined by the lifetime lease of the object
Examples of the Singleton activation mode
Applications in which multiple clients talk to the same remote object and share data between
one another through this object.
Ex: Chat server
2. Client-Activated Objects
Lifetime is directly controlled by the client.
Client, has the complete control over the lifetime of the objects.
Client-activated objects are instantiated on the server as soon as the client requests the
object to be created.
A CAO can be created using any of the available constructors for the class.
Comparing the Object Activation Techniques
Lifetime Leases
A lifetime lease is the period of time that a particular object can be active in memory before
the .NET framework deletes it and reclaims its memory.
Both Singleton SAO and CAO use lifetime leases to determine how long they should
continue to exist.
A lifetime lease is represented using an object that implements the ILease interface defined
in the System.Runtime.Remoting.Lifetime namespace.
Important Members of the ILEASE Interface
Member Name Type Description
CurrentLeaseTime Property Returns the amount of time remaining on the
lease as a TimeSpan object.
InitialLeaseTime Property Indicates the default lifetime of the object. If
the object does not receive any method calls,
it will only live for this period.
Register() Method Specifies an object to be notified when a lease
needs to be renewed.
Renew() Method Renews a lease for the specified TimeSpan
RenewOnCallTime Property Each time the remote object is called, the
lease is renewed for this much time.
SponsorshipTimeout Property Specifies the amount of time to wait for a
sponsor object to respond to a renewal
request.
How leases work?
When an object is created, its lifetime lease (CurrentLeaseTime) is set using the value
of the InitialLeaseTime property.(which is 5 minutes by default).
Whenever the object receives a call, its CurrentLeaseTime is reset to the time
specified by the value of the RenewOnCallTime property. (which is 2 minutes by
default).
The client can also renew a lease for a remote object by directly calling the
ILease.Renew() method
When the value of CurrentLeaseTime reaches 0, the .NET Framework contacts any
sponsors registered with the lease to check if they are ready to sponsor renewing the
object’s lease.
If the sponsor does not renew the object or the server cannot contact the sponsor within the
duration specified by the SponsorshipTimeout property, the object is marked for garbage
collection.
Serialization
Serialization is the process of converting an object into a stream of bytes in order to
store the object or transmit it to memory, a database, or a file.
Its main purpose is to save the state of an object in order to be able to recreate it when
needed.
The reverse process is called Deserialization.
How Serialization Works
The object is serialized to a stream, which carries not
just the data, but information about the object's type,
such as its version, culture, and assembly name.
From that stream, it can be stored in a database, a
file, or memory.
Uses of Serialization
Allows the developer to save the state of an object and recreate it as needed, providing
storage of objects as well as data exchange.
Sending the object to a remote application by means of a Web Service.
Passing an object from one domain to another.
Passing an object through a firewall as an XML string.
Maintaining security or user-specific information across applications.
Making an Object Serializable
To serialize an object, you need the object to be serialized, a stream to contain the serialized
object, and a Formatter.System.Runtime.Serialization contains the classes necessary for
serializing and deserializing objects.
Apply the SerializableAttribute attribute to a type to indicate that instances of this type can be
serialized. A SerializationException exception is thrown if you attempt to serialize but the type
does not have the SerializableAttribute attribute.
If you do not want a field within your class to be serializable, apply
the NonSerializedAttribute attribute.
If a field of a serializable type contains a pointer, a handle, or some other data structure
that is specific to a particular environment, and the field cannot be meaningfully
reconstituted in a different environment, then you may want to make it nonserializable.
If a serialized class contains references to objects of other classes that are
marked SerializableAttribute, those objects will also be serialized.
Binary and XML Serialization
Binary Serialization
Uses binary encoding to produce compact serialization for uses such as storage or socket-
based network streams.
All members, even those that are read-only, are serialized, and performance is enhanced.
XML serialization provides more readable code, as well as greater flexibility of object sharing
and usage for interoperability purposes.
XML Serialization
XML serialization serializes the public fields and properties of an object, or the
parameters and return values of methods, into an XML stream that conforms to a
specific XML Schema definition language (XSD) document.
XML serialization results in strongly typed classes with public properties and fields that
are converted to XML. System.Xml.Serialization contains the classes necessary for
serializing and deserializing XML.
You can apply attributes to classes and class members in order to control the way
the XmlSerializer serializes or deserializes an instance of the class.
Basic and Custom Serialization
Basic Serialization
Basic serialization uses the .NET Framework to automatically serialize the object.
The only requirement in basic serialization is that the object has
the SerializableAttribute attribute applied. The NonSerializedAttribute can be used to
keep specific fields from being serialized.
When you use basic serialization, the versioning of objects may create problems, in which
case custom serialization may be preferable. Basic serialization is the easiest way to perform
serialization, but it does not provide much control over the process.
Custom Serialization
In custom serialization, you can specify exactly which objects will be serialized and how
it will be done. The class must be marked SerializableAttribute and implement
the ISerializable interface.
If you want your object to be deserialized in a custom manner as well, you must use a
custom constructor.
Designer Serialization
Designer serialization is a special form of serialization that involves the kind of object
persistence usually associated with development tools.
Designer serialization is the process of converting an object graph into a source file that can
later be used to recover the object graph.
 A source file can contain code, markup, or even SQL table information.
Remoting Application
THANK YOU!

More Related Content

What's hot

Principles of virtualization
Principles of virtualizationPrinciples of virtualization
Principles of virtualizationRubal Sagwal
 
Android architecture
Android architectureAndroid architecture
Android architecturepoojapainter
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
Cloud Computing and Vertualization
Cloud Computing and VertualizationCloud Computing and Vertualization
Cloud Computing and VertualizationReach Chirag
 
Web servers for the Internet of Things
Web servers for the Internet of ThingsWeb servers for the Internet of Things
Web servers for the Internet of ThingsAlexandru Radovici
 
Wireless network security
Wireless network securityWireless network security
Wireless network securityVishal Agarwal
 
Cloud computing and utility computing
Cloud computing and utility computingCloud computing and utility computing
Cloud computing and utility computingasmita tarar
 
Cloud security Presentation
Cloud security PresentationCloud security Presentation
Cloud security PresentationAjay p
 
ACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easyACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easyGabriell Nascimento
 
Microsoft Azure Security Overview
Microsoft Azure Security OverviewMicrosoft Azure Security Overview
Microsoft Azure Security OverviewAlert Logic
 
Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Ankit Gupta
 
Lesson 5 resolution
Lesson 5  resolutionLesson 5  resolution
Lesson 5 resolutionhwells2101
 
Storage As A Service (StAAS)
Storage As A Service (StAAS)Storage As A Service (StAAS)
Storage As A Service (StAAS)Shreyans Jain
 
Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud ComputingJithin Parakka
 

What's hot (20)

Principles of virtualization
Principles of virtualizationPrinciples of virtualization
Principles of virtualization
 
Coda file system
Coda file systemCoda file system
Coda file system
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Cloud Computing and Vertualization
Cloud Computing and VertualizationCloud Computing and Vertualization
Cloud Computing and Vertualization
 
Web servers for the Internet of Things
Web servers for the Internet of ThingsWeb servers for the Internet of Things
Web servers for the Internet of Things
 
Cloud Reference Model
Cloud Reference ModelCloud Reference Model
Cloud Reference Model
 
Wireless network security
Wireless network securityWireless network security
Wireless network security
 
Cloud computing and utility computing
Cloud computing and utility computingCloud computing and utility computing
Cloud computing and utility computing
 
Cloud security Presentation
Cloud security PresentationCloud security Presentation
Cloud security Presentation
 
Security As A Service In Cloud(SECaaS)
Security As A Service In Cloud(SECaaS)Security As A Service In Cloud(SECaaS)
Security As A Service In Cloud(SECaaS)
 
Virtualization vs. Cloud Computing: What's the Difference?
Virtualization vs. Cloud Computing: What's the Difference?Virtualization vs. Cloud Computing: What's the Difference?
Virtualization vs. Cloud Computing: What's the Difference?
 
ACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easyACME and Let's Encrypt: HTTPS made easy
ACME and Let's Encrypt: HTTPS made easy
 
CLOUD COMPUTING UNIT-1
CLOUD COMPUTING UNIT-1CLOUD COMPUTING UNIT-1
CLOUD COMPUTING UNIT-1
 
Microsoft Azure Security Overview
Microsoft Azure Security OverviewMicrosoft Azure Security Overview
Microsoft Azure Security Overview
 
Intro to Amazon ECS
Intro to Amazon ECSIntro to Amazon ECS
Intro to Amazon ECS
 
Week 4 lecture material cc (1)
Week 4 lecture material cc (1)Week 4 lecture material cc (1)
Week 4 lecture material cc (1)
 
Lesson 5 resolution
Lesson 5  resolutionLesson 5  resolution
Lesson 5 resolution
 
Storage As A Service (StAAS)
Storage As A Service (StAAS)Storage As A Service (StAAS)
Storage As A Service (StAAS)
 
Market oriented Cloud Computing
Market oriented Cloud ComputingMarket oriented Cloud Computing
Market oriented Cloud Computing
 

Similar to Remoting and serialization

CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptxFamiDan
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software conceptsPrajakta Rane
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIPrajakta Rane
 
DS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfDS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfVarshaBaini
 
Distributed Systems Architecture in Software Engineering SE11
Distributed Systems Architecture in Software Engineering SE11Distributed Systems Architecture in Software Engineering SE11
Distributed Systems Architecture in Software Engineering SE11koolkampus
 
dotnet_remoting
dotnet_remotingdotnet_remoting
dotnet_remotingOPENLANE
 
Distributed Objects and Remote Invocation
Distributed Objects and Remote InvocationDistributed Objects and Remote Invocation
Distributed Objects and Remote InvocationMedicaps University
 
Module 3 remote method invocation-2
Module 3   remote method  invocation-2Module 3   remote method  invocation-2
Module 3 remote method invocation-2Ankit Dubey
 
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...FIWARE
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3farshad33
 
Communication in Distributed System.ppt
Communication in Distributed System.pptCommunication in Distributed System.ppt
Communication in Distributed System.pptSELVAVINAYAGAMG
 
Microsoft Exchange Technology Overview
Microsoft Exchange Technology OverviewMicrosoft Exchange Technology Overview
Microsoft Exchange Technology OverviewMike Pruett
 

Similar to Remoting and serialization (20)

CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptx
 
Chapter 6-Remoting
Chapter 6-RemotingChapter 6-Remoting
Chapter 6-Remoting
 
2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts2. Distributed Systems Hardware & Software concepts
2. Distributed Systems Hardware & Software concepts
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMI
 
Ch12
Ch12Ch12
Ch12
 
RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
DS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfDS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdf
 
Dot NET Remoting
Dot NET RemotingDot NET Remoting
Dot NET Remoting
 
13th june
13th june13th june
13th june
 
Distributed Systems Architecture in Software Engineering SE11
Distributed Systems Architecture in Software Engineering SE11Distributed Systems Architecture in Software Engineering SE11
Distributed Systems Architecture in Software Engineering SE11
 
About HTTP and REST
About HTTP and RESTAbout HTTP and REST
About HTTP and REST
 
dotnet_remoting
dotnet_remotingdotnet_remoting
dotnet_remoting
 
Distributed Objects and Remote Invocation
Distributed Objects and Remote InvocationDistributed Objects and Remote Invocation
Distributed Objects and Remote Invocation
 
Resume
ResumeResume
Resume
 
Module 3 remote method invocation-2
Module 3   remote method  invocation-2Module 3   remote method  invocation-2
Module 3 remote method invocation-2
 
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
FIWARE Global Summit - OpenMTC – An Open Source Implementation of the oneM2M ...
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
Communication in Distributed System.ppt
Communication in Distributed System.pptCommunication in Distributed System.ppt
Communication in Distributed System.ppt
 
Microsoft Exchange Technology Overview
Microsoft Exchange Technology OverviewMicrosoft Exchange Technology Overview
Microsoft Exchange Technology Overview
 

Recently uploaded

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Recently uploaded (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

Remoting and serialization

  • 1. Remoting & Serialization BY Chathurangi Shyalika KDU-IT-Intake XXXI
  • 3. An Application domain, or AppDomain, is the smallest execution unit for a .NET application. The CLR allows several application domains to run within a single Windows process. Distributed Applications enable communication between objects that run in different application domains and processes. System.Net, System.Runtime.Remoting and System.Web.Services namespaces enable the .NET Framework to support distributed application development.
  • 4. .NET Remoting The System.Runtime.Remoting Namespace —This namespace includes the classes that constitutes the .NET remoting framework. The .NET remoting framework enables communication between objects living in different Appdomains whether or not they are on the same computer. Remoting provides an abstraction over the complexities of network programming and exposes a simple mechanism for inter application domain communication. The key objectives of .NET remoting are flexibility and extensibility.
  • 5. Services Object Activation Object Lifetime Support Communication Channels Formatters
  • 6. .NET Remoting layer revolves around a careful orchestration that takes place between four key players: • Proxies • Messages • Channels • Formatters Key Players
  • 7. .NET Remoting Components A remotable object: Which is an object that contain some properties and methods located in one application domain and you need to call its methods or properties from another application domain or process. A host application (server application): The main task of this host is to listen to requests for the hosted remotable object. A client application: This is the application which makes requests for the remotable object.
  • 8. Types of Remotable Objects There are 3 types of remotable objects that you can configure and choose from depending on the requirements of your application.  Single Call: Service one and only one request coming in  Singleton Call: Service multiple clients and is useful when data needs to be shared explicilty between several clients.  Client Activation: Richer than singleton in many aspects as they can store the state information between method calls for its specific client.
  • 9. .NET Remoting Architecture 1. When a client object wants to create an instance of the server object, the remoting system at the client side instead creates a proxy of the server object. 2. When the client object calls a method on the server object, the proxy passes the call information to the remoting system on the client. This remoting system in turn sends the call over the channel to the remoting system on the server.
  • 10. Cont. 3. The remoting system on the server receives the call information and, on the basis of it, invokes the method on the actual object on the server (creating the object if necessary). 4. The remoting system on the server collects all the results of the method invocation and passes them through the channel to the remoting system on the client. 5. The remoting system at the client receives the response of the server and returns the results to the client object through the proxy.
  • 11. .Net Remoting Vs Web Services XML Web Services: • Simple, loosely coupled programming model. • Can be accessed only over HTTP and work in a stateless environment. • Services hosted in IIS. .Net Remoting: • Tightly coupled and more complex programming model. • Can be accessed over any protocol and support both stateful and stateless environments. • Services hosted in any AppDomain.
  • 13. Marshalling or Marshaling is the process of transforming the memory representation of an objet to a data format suitable for storage or transmission. Used when data must be moved between different parts of a computer program or from one program to another. Marshalling is similar to serialization and is used to communicate to remote objects with an object, in this case a serialized object.
  • 14. Cont. It simplifies complex communication, using custom/complex objects to communicate instead of primitives. Marshalling is the process of packaging and unpackaging parameters so a remote procedure call can take place. Remotable objects are objects that can be marshalled across the application domains. In contrast, all other objects are known as nonremotable objects.
  • 15. Usage Used within implementation of different remote procedure call mechanisms, where it is necessary to transport data between processes and/or between threads. In Microsoft's Component Object Model interface pointers must be marshalled when crossing Component Object Model apartment boundaries.
  • 16. Example Marshaling an integer parameter involves simply copying the value into the message buffer. Marshaling an array is a more complex process. Array members are copied in a specific order so that the other side can reconstruct the array exactly. When a pointer is marshaled, the data that the pointer is pointing to is copied following rules and conventions for dealing with nested pointers in structures. Unique functions exist to handle the marshaling of each parameter type.
  • 17.
  • 18. Types of Remotable Objects Marshal-by-value (MBV) Objects — These objects are copied and passed out of the server application domain to the client application domain. Marshal-by-reference (MBR) Objects — These objects are accessed on the client side using a proxy. The client just holds a reference to these objects.
  • 19. Marshal-by-value (MBV) Objects MBV objects reside on the server. When the client invokes a method on the MBV object, the MBV object is serialized, transferred over the network, and restored on the client as an exact copy of the server-side object. The method is then invoked directly on the client. When this happens, the MBV object is no longer a remote object. Any method calls to the object do not require any proxy object or marshalling because the object is locally available. The MBV objects can provide faster performance by reducing the number of network roundtrips, but in the case of large objects, the time taken to transfer the serialized object from the server to the client can be very significant. MBV objects do not allow you the flexibility to run the remote object in the server environment. A MBV object can be created by declaring a class with the Serializable attribute.
  • 20. Marshal-by-reference (MBR) Objects They always reside on the server. All methods invoked on these objects are executed at the server side. The client communicates with the MBR object on the server using a local proxy object that holds the reference to the MBR object. Although the use of MBR objects increases the number of network roundtrips, they are a good choice when the objects are prohibitively large or when the functionality of the object is only available in the server environment on which it is created. An MBR object can be created by deriving from the System.MarshalByRefObject class.
  • 22. Channel is an object that transports messages across remoting boundaries Channels are responsible for passing messages across remoting boundaries. Channels must be registered before `objects are created as per application domain. A channel has two endpoints. The channel object at the receiving end of a channel (the server) listens to a particular protocol using the specified port number, whereas the channel object at the sending end of the channel (the client) sends information to the receiving end using the protocol and port number specified by the channel object on the receiving end.
  • 23. The .NET Framework provides implementations for two channels.  HTTP (Hypertext Transfer Protocol)  TCP (Transmission Control Protocol) channels. If you want to use a different protocol, you can define your own channel by implementing the IChannelReceiver and IChannelSender interfaces.
  • 24. HTTP Channels HTTP channels use HTTP for establishing communication betweenthe two ends. These channels are implemented through the classes of the System.Runtime.Remoting.Channels.Http namespace. The ChannelServices class is used to register a sender-receiver HTTP channel. One of its static methods used there is RegisterChannel(), which helps in registering a channel with the remoting framework.
  • 25. The HTTP Channel Classes CLASS INTERFACE PURPOSE HttpServerChannel IChannelReceiver An implementation for a server channel that uses the HTTP protocol to receive messages HttpClientChannel IChannelSender An implementation for a client channel that uses the HTTP protocol to send messages HttpChannel IChannelReceiver IChannelSender An implementation of a combined and channel that provides the functionality of both the HttpServerChannel and the HttpClientChannel classes
  • 26. TCP Channels A TCP channel uses TCP for establishing communication between the two ends. The TCP channel is implemented through various classes of the System.Runtime.Remoting.Channels.Tcp namespace.
  • 27. The TCP Channel Classes CLASS INTERFACE PURPOSE TcpServerChannel IChannelReceiver An implementation for a server channel that uses the TCP protocol to receive messages TcpClientChannel IChannelSender An implementation for a client channel that uses the TCP protocol to send messages TcpChannel IChannelReceiver An implementation of a combined and channel that provides the IChannelSender functionality for both the TcpServerChannel and TcpClientChannel classes
  • 28. Choosing Between HTTP Channel and TCP Channels Channel Scope Efficiency Security HttpChannel Wide Less More TcpChannel Narrow More Less
  • 30. The objects used to encode and serialize data into messages. A formatter class must implement the IFormatter interface. The .NET Framework packages two native formatter classes; 1. BinaryFormatter class 2. SoapFormatter class
  • 31. The SOAP Formatter SOAP - Simple Object Access Protocol Straightforward, XML-based protocol for exchanging types and messages between applications An extensible and modular protocol Implemented in the SoapFormatter class of the System.Runtime.Serialization.Formatters.Soap namespace
  • 32. The Binary Formatter Can be understood only within .NET applications Compact and efficient Implemented in the BinaryFormatter class of the System.Runtime.Serialization.Formatters.Binary namespace
  • 33. Channels and Formatters HTTP channel uses the SOAP formatter. HTTP channel uses; - SoapClientFormatterSinkProvider class - SoapServerFormatterSinkProvider class to serialize and deserialize messages Can create industry-standard XML Web services
  • 34. Cont. TCP channel uses the binary formatter. TCP channel uses; - BinaryClientFormatterSinkProvider class - BinaryServerFormatterSinkProvider class to serialize and deserialize messages.
  • 35. Cont.
  • 36. Remote Object Activation and Lifetime Leases
  • 37. Remote Object Activation Only MBR objects can be activated remotely. No remote activation is needed for of MBV objects because -the MBV object itself is transferred to the client side. Based on the activation mode, an MBR object is classified into one of the following two categories: Server-activated objects Client-activated objects
  • 39. 1. Server-Activated Objects Server-activated objects (SAO) are those remote objects whose lifetime is directly controlled by the server. When a client requests an instance of a server-activated object, a proxy to the remote object is created in the client’s application domain. The remote object is only instantiated (or activated) on the server when the client calls a method on the proxy object. Limited flexibility. Two activation modes for a server-activated object: 1.SingleCall activation mode 2.Singleton activation mode
  • 40. SingleCall Activation Mode An object is instantiated for responding to just one client request. After the request is fulfilled, the .NET remoting framework deletes the object and reclaims its memory. Also known as stateless because the objects are created and destroyed with each client request; therefore, they do not maintain state across requests. Allows for greater server scalability as an object consumes server resources only for a small period, therefore allowing the server to allocate resources to other objects.
  • 41.
  • 42. Examples of the SingleCall activation mode Applications in which the object is required by the client to do a small amount of work and then the object is no longer required. retrieving the inventory level for an item displaying tracking information for a shipment
  • 43. Singleton Activation Mode There is one instance of the remote object regardless of the number of clients accessing it. Maintain state information across method calls. Such objects are also sometimes known as Stateful objects. Object is globally shared by all of its clients. A Singleton object does not exist on the server forever. Its lifetime is determined by the lifetime lease of the object
  • 44.
  • 45. Examples of the Singleton activation mode Applications in which multiple clients talk to the same remote object and share data between one another through this object. Ex: Chat server
  • 46. 2. Client-Activated Objects Lifetime is directly controlled by the client. Client, has the complete control over the lifetime of the objects. Client-activated objects are instantiated on the server as soon as the client requests the object to be created. A CAO can be created using any of the available constructors for the class.
  • 47.
  • 48. Comparing the Object Activation Techniques
  • 49. Lifetime Leases A lifetime lease is the period of time that a particular object can be active in memory before the .NET framework deletes it and reclaims its memory. Both Singleton SAO and CAO use lifetime leases to determine how long they should continue to exist. A lifetime lease is represented using an object that implements the ILease interface defined in the System.Runtime.Remoting.Lifetime namespace.
  • 50. Important Members of the ILEASE Interface Member Name Type Description CurrentLeaseTime Property Returns the amount of time remaining on the lease as a TimeSpan object. InitialLeaseTime Property Indicates the default lifetime of the object. If the object does not receive any method calls, it will only live for this period. Register() Method Specifies an object to be notified when a lease needs to be renewed. Renew() Method Renews a lease for the specified TimeSpan RenewOnCallTime Property Each time the remote object is called, the lease is renewed for this much time. SponsorshipTimeout Property Specifies the amount of time to wait for a sponsor object to respond to a renewal request.
  • 51. How leases work? When an object is created, its lifetime lease (CurrentLeaseTime) is set using the value of the InitialLeaseTime property.(which is 5 minutes by default). Whenever the object receives a call, its CurrentLeaseTime is reset to the time specified by the value of the RenewOnCallTime property. (which is 2 minutes by default). The client can also renew a lease for a remote object by directly calling the ILease.Renew() method
  • 52. When the value of CurrentLeaseTime reaches 0, the .NET Framework contacts any sponsors registered with the lease to check if they are ready to sponsor renewing the object’s lease. If the sponsor does not renew the object or the server cannot contact the sponsor within the duration specified by the SponsorshipTimeout property, the object is marked for garbage collection.
  • 54. Serialization is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called Deserialization.
  • 55. How Serialization Works The object is serialized to a stream, which carries not just the data, but information about the object's type, such as its version, culture, and assembly name. From that stream, it can be stored in a database, a file, or memory.
  • 56. Uses of Serialization Allows the developer to save the state of an object and recreate it as needed, providing storage of objects as well as data exchange. Sending the object to a remote application by means of a Web Service. Passing an object from one domain to another. Passing an object through a firewall as an XML string. Maintaining security or user-specific information across applications.
  • 57. Making an Object Serializable To serialize an object, you need the object to be serialized, a stream to contain the serialized object, and a Formatter.System.Runtime.Serialization contains the classes necessary for serializing and deserializing objects. Apply the SerializableAttribute attribute to a type to indicate that instances of this type can be serialized. A SerializationException exception is thrown if you attempt to serialize but the type does not have the SerializableAttribute attribute.
  • 58. If you do not want a field within your class to be serializable, apply the NonSerializedAttribute attribute. If a field of a serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and the field cannot be meaningfully reconstituted in a different environment, then you may want to make it nonserializable. If a serialized class contains references to objects of other classes that are marked SerializableAttribute, those objects will also be serialized.
  • 59. Binary and XML Serialization Binary Serialization Uses binary encoding to produce compact serialization for uses such as storage or socket- based network streams. All members, even those that are read-only, are serialized, and performance is enhanced. XML serialization provides more readable code, as well as greater flexibility of object sharing and usage for interoperability purposes.
  • 60. XML Serialization XML serialization serializes the public fields and properties of an object, or the parameters and return values of methods, into an XML stream that conforms to a specific XML Schema definition language (XSD) document. XML serialization results in strongly typed classes with public properties and fields that are converted to XML. System.Xml.Serialization contains the classes necessary for serializing and deserializing XML. You can apply attributes to classes and class members in order to control the way the XmlSerializer serializes or deserializes an instance of the class.
  • 61. Basic and Custom Serialization Basic Serialization Basic serialization uses the .NET Framework to automatically serialize the object. The only requirement in basic serialization is that the object has the SerializableAttribute attribute applied. The NonSerializedAttribute can be used to keep specific fields from being serialized. When you use basic serialization, the versioning of objects may create problems, in which case custom serialization may be preferable. Basic serialization is the easiest way to perform serialization, but it does not provide much control over the process.
  • 62. Custom Serialization In custom serialization, you can specify exactly which objects will be serialized and how it will be done. The class must be marked SerializableAttribute and implement the ISerializable interface. If you want your object to be deserialized in a custom manner as well, you must use a custom constructor.
  • 63. Designer Serialization Designer serialization is a special form of serialization that involves the kind of object persistence usually associated with development tools. Designer serialization is the process of converting an object graph into a source file that can later be used to recover the object graph.  A source file can contain code, markup, or even SQL table information.
  • 65.