CSLA.NET
6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ObjectCloner.cs
Go to the documentation of this file.
1
//-----------------------------------------------------------------------
2
// <copyright file="ObjectCloner.cs" company="Marimer LLC">
3
// Copyright (c) Marimer LLC. All rights reserved.
4
// Website: https://cslanet.com
5
// </copyright>
6
// <summary>This class provides an implementation of a deep</summary>
7
//-----------------------------------------------------------------------
8
using
Csla
.
Serialization
;
9
using
System;
10
using
System.IO;
11
12
namespace
Csla.Core
13
{
19
public
class
ObjectCloner
20
{
21
private
ApplicationContext
ApplicationContext
{
get
;
set
; }
22
27
public
ObjectCloner
(
ApplicationContext
applicationContext)
28
{
29
ApplicationContext
= applicationContext;
30
}
31
37
public
static
ObjectCloner
GetInstance
(
ApplicationContext
applicationContext)
38
{
39
return
new
ObjectCloner
(applicationContext);
40
}
41
52
public
object
Clone
(
object
obj)
53
{
54
using
var buffer =
new
MemoryStream();
55
ISerializationFormatter
formatter =
56
SerializationFormatterFactory.GetFormatter(
ApplicationContext
);
57
formatter.
Serialize
(buffer, obj);
58
buffer.Position = 0;
59
return
formatter.
Deserialize
(buffer);
60
}
61
}
62
}
Csla.ApplicationContext
Provides consistent context information between the client and server DataPortal objects.
Definition:
ApplicationContext.cs:22
Csla.Core.ObjectCloner
This class provides an implementation of a deep clone of a complete object graph.
Definition:
ObjectCloner.cs:20
Csla.Core.ObjectCloner.ObjectCloner
ObjectCloner(ApplicationContext applicationContext)
Creates an instance of the type.
Definition:
ObjectCloner.cs:27
Csla.Core.ObjectCloner.GetInstance
static ObjectCloner GetInstance(ApplicationContext applicationContext)
Gets an instance of ObjectCloner.
Definition:
ObjectCloner.cs:37
Csla.Core.ObjectCloner.Clone
object Clone(object obj)
Clones an object.
Definition:
ObjectCloner.cs:52
Csla.Serialization.ISerializationFormatter
Defines an object that can serialize and deserialize object graphs.
Definition:
ISerializationFormatter.cs:17
Csla.Serialization.ISerializationFormatter.Serialize
void Serialize(System.IO.Stream serializationStream, object graph)
Converts an object graph into a byte stream.
Csla.Serialization.ISerializationFormatter.Deserialize
object Deserialize(System.IO.Stream serializationStream)
Converts a serialization stream into an object graph.
Csla.Core
Definition:
AddedNewEventArgs.cs:11
Csla.Serialization
Definition:
AutoNonSerializedAttribute.cs:11
Csla
Definition:
BusinessRuleCases.cs:5
Generated by
1.9.2