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.
MobileObject.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="MobileObject.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Inherit from this base class to easily</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.ComponentModel;
11
12namespace Csla.Core
13{
19 public abstract class MobileObject : IMobileObject
20 {
21 #region Serialize
22
24 {
25 OnGetChildren(info, formatter);
26 }
27
29 {
30 OnGetState(info, StateMode.Serialization);
31 }
32
43 [EditorBrowsable(EditorBrowsableState.Advanced)]
44 protected virtual void OnGetState(SerializationInfo info, StateMode mode)
45 { }
46
58 [EditorBrowsable(EditorBrowsableState.Advanced)]
59 protected virtual void OnGetChildren(SerializationInfo info, MobileFormatter formatter)
60 { }
61
62 #endregion
63
64 #region Deserialize
65
67 {
68 OnSetState(info, StateMode.Serialization);
69 }
70
72 {
73 OnSetChildren(info, formatter);
74 }
75
86 [EditorBrowsable(EditorBrowsableState.Advanced)]
87 protected virtual void OnSetState(SerializationInfo info, StateMode mode)
88 { }
89
101 [EditorBrowsable(EditorBrowsableState.Advanced)]
102 protected virtual void OnSetChildren(SerializationInfo info, MobileFormatter formatter)
103 { }
104
105 #endregion
106 }
107}
Inherit from this base class to easily create a serializable class.
Definition: MobileObject.cs:20
virtual void OnSetChildren(SerializationInfo info, MobileFormatter formatter)
Override this method to retrieve your child object references from the MobileFormatter serialzation s...
virtual void OnGetChildren(SerializationInfo info, MobileFormatter formatter)
Override this method to insert your child object references into the MobileFormatter serialzation str...
Definition: MobileObject.cs:59
virtual void OnGetState(SerializationInfo info, StateMode mode)
Override this method to insert your field values into the MobileFormatter serialzation stream.
Definition: MobileObject.cs:44
virtual void OnSetState(SerializationInfo info, StateMode mode)
Override this method to retrieve your field values from the MobileFormatter serialzation stream.
Definition: MobileObject.cs:87
Serializes and deserializes objects at the field level.
Object containing the serialization data for a specific object.
Interface to be implemented by any object that supports serialization by the SerializationFormatterFa...
void GetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should serialize its child references.
void GetState(SerializationInfo info)
Method called by MobileFormatter when an object should serialize its data.
void SetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should deserialize its child references.
void SetState(SerializationInfo info)
Method called by MobileFormatter when an object should be deserialized.
StateMode
Indicates the reason the MobileFormatter functionality has been invoked.
Definition: StateMode.cs:20
@ Serializable
Prevents updating or inserting until the transaction is complete.