1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4 
5 namespace System.ServiceModel.Activities
6 {
7     using System.Diagnostics.CodeAnalysis;
8     using System.Runtime;
9     using System.Runtime.DurableInstancing;
10     using System.Runtime.Serialization;
11 
12     [DataContract(Name = "InstanceValue", Namespace = XD2.DurableInstancing.Namespace)]
13     class SerializableInstanceValue
14     {
15         object value;
16         int options;
17 
SerializableInstanceValue(InstanceValue instanceValue)18         public SerializableInstanceValue(InstanceValue instanceValue)
19         {
20             this.value = instanceValue.Value;
21             this.options = (int)instanceValue.Options;
22         }
23 
24         [DataMember(EmitDefaultValue = false)]
25         [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "Called from Serialization")]
26         internal object Value
27         {
28             get
29             {
30                 return this.value;
31             }
32 
33             set
34             {
35                 this.value = value;
36             }
37         }
38 
39         [DataMember(EmitDefaultValue = false)]
40         [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "Called from Serialization")]
41         internal int Options
42         {
43             get
44             {
45                 return this.options;
46             }
47 
48             set
49             {
50                 this.options = value;
51             }
52         }
53 
ToInstanceValue()54         public InstanceValue ToInstanceValue()
55         {
56             return new InstanceValue(this.value, (InstanceValueOptions)this.options);
57         }
58     }
59 }
60