@@ -27,7 +27,7 @@ public JsonApiDeSerializer(
2727 public object Deserialize ( string requestBody )
2828 {
2929 var document = JsonConvert . DeserializeObject < Document > ( requestBody ) ;
30- var entity = DataToObject ( document . Data ) ;
30+ var entity = DocumentToObject ( document . Data ) ;
3131 return entity ;
3232 }
3333
@@ -46,30 +46,29 @@ public object DeserializeRelationship(string requestBody)
4646 return new List < DocumentData > { data . ToObject < DocumentData > ( ) } ;
4747 }
4848
49-
5049 public List < TEntity > DeserializeList < TEntity > ( string requestBody )
5150 {
5251 var documents = JsonConvert . DeserializeObject < Documents > ( requestBody ) ;
5352
5453 var deserializedList = new List < TEntity > ( ) ;
5554 foreach ( var data in documents . Data )
5655 {
57- var entity = DataToObject ( data ) ;
56+ var entity = DocumentToObject ( data ) ;
5857 deserializedList . Add ( ( TEntity ) entity ) ;
5958 }
6059
6160 return deserializedList ;
6261 }
6362
64- private object DataToObject ( DocumentData data )
63+ private object DocumentToObject ( DocumentData data )
6564 {
6665 var contextEntity = _jsonApiContext . ContextGraph . GetContextEntity ( data . Type ) ;
6766 _jsonApiContext . RequestEntity = contextEntity ;
6867
6968 var entity = Activator . CreateInstance ( contextEntity . EntityType ) ;
7069
71- entity = _setEntityAttributes ( entity , contextEntity , data . Attributes ) ;
72- entity = _setRelationships ( entity , contextEntity , data . Relationships ) ;
70+ entity = SetEntityAttributes ( entity , contextEntity , data . Attributes ) ;
71+ entity = SetRelationships ( entity , contextEntity , data . Relationships ) ;
7372
7473 var identifiableEntity = ( IIdentifiable ) entity ;
7574
@@ -79,7 +78,7 @@ private object DataToObject(DocumentData data)
7978 return identifiableEntity ;
8079 }
8180
82- private object _setEntityAttributes (
81+ private object SetEntityAttributes (
8382 object entity , ContextEntity contextEntity , Dictionary < string , object > attributeValues )
8483 {
8584 if ( attributeValues == null || attributeValues . Count == 0 )
@@ -99,13 +98,14 @@ private object _setEntityAttributes(
9998 {
10099 var convertedValue = TypeHelper . ConvertType ( newValue , entityProperty . PropertyType ) ;
101100 entityProperty . SetValue ( entity , convertedValue ) ;
101+ _jsonApiContext . AttributesToUpdate [ attr ] = convertedValue ;
102102 }
103103 }
104104
105105 return entity ;
106106 }
107107
108- private object _setRelationships (
108+ private object SetRelationships (
109109 object entity ,
110110 ContextEntity contextEntity ,
111111 Dictionary < string , RelationshipData > relationships )
@@ -118,14 +118,14 @@ private object _setRelationships(
118118 foreach ( var attr in contextEntity . Relationships )
119119 {
120120 entity = attr . IsHasOne
121- ? _setHasOneRelationship ( entity , entityProperties , attr , contextEntity , relationships )
122- : _setHasManyRelationship ( entity , entityProperties , attr , contextEntity , relationships ) ;
121+ ? SetHasOneRelationship ( entity , entityProperties , attr , contextEntity , relationships )
122+ : SetHasManyRelationship ( entity , entityProperties , attr , contextEntity , relationships ) ;
123123 }
124124
125125 return entity ;
126126 }
127127
128- private object _setHasOneRelationship ( object entity ,
128+ private object SetHasOneRelationship ( object entity ,
129129 PropertyInfo [ ] entityProperties ,
130130 RelationshipAttribute attr ,
131131 ContextEntity contextEntity ,
@@ -158,7 +158,7 @@ private object _setHasOneRelationship(object entity,
158158 return entity ;
159159 }
160160
161- private object _setHasManyRelationship ( object entity ,
161+ private object SetHasManyRelationship ( object entity ,
162162 PropertyInfo [ ] entityProperties ,
163163 RelationshipAttribute attr ,
164164 ContextEntity contextEntity ,
0 commit comments