@@ -13,7 +13,7 @@ public abstract class CouchDocument
13
13
protected CouchDocument ( )
14
14
{
15
15
_conflicts = new List < string > ( ) ;
16
- _attachments = new Dictionary < string , CouchAttachment > ( ) ;
16
+ AttachmentsParsed = new Dictionary < string , CouchAttachment > ( ) ;
17
17
Attachments = new CouchAttachmentsCollection ( ) ;
18
18
}
19
19
@@ -44,15 +44,10 @@ protected CouchDocument()
44
44
[ JsonIgnore ]
45
45
public IReadOnlyCollection < string > Conflicts => _conflicts . AsReadOnly ( ) ;
46
46
47
- // This must be Deserilizable-only field
48
- [ JsonIgnore ]
49
- private Dictionary < string , CouchAttachment > _attachments ;
47
+ // This must be for serialization only field
50
48
[ DataMember ]
51
49
[ JsonProperty ( "_attachments" ) ]
52
- private Dictionary < string , CouchAttachment > AttachmentsSetter
53
- {
54
- set { _attachments = value ; }
55
- }
50
+ private Dictionary < string , CouchAttachment > AttachmentsParsed { get ; set ; }
56
51
57
52
[ JsonIgnore ]
58
53
public CouchAttachmentsCollection Attachments { get ; internal set ; }
@@ -64,9 +59,9 @@ private Dictionary<string, CouchAttachment> AttachmentsSetter
64
59
[ OnDeserialized ]
65
60
internal void OnDeserializedMethod ( StreamingContext context )
66
61
{
67
- if ( _attachments != null && _attachments . Count > 0 )
62
+ if ( AttachmentsParsed is { Count : > 0 } )
68
63
{
69
- Attachments = new CouchAttachmentsCollection ( _attachments ) ;
64
+ Attachments = new CouchAttachmentsCollection ( AttachmentsParsed ) ;
70
65
}
71
66
}
72
67
}
0 commit comments