Skip to content

Commit fe0d655

Browse files
committed
Avoid duplicating values in JSON for deserialization
1 parent 200d2d3 commit fe0d655

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/TableStorage/TableRepository`1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ T ToEntity(TableEntity entity)
193193
// perform its advanced ctor and conversion detection as usual.
194194
writer.WriteStartObject();
195195

196-
if (partitionKeyProperty != null)
196+
if (partitionKeyProperty != null && !entity.ContainsKey(partitionKeyProperty))
197197
writer.WriteString(partitionKeyProperty, entity.PartitionKey);
198198

199-
if (rowKeyProperty != null)
199+
if (rowKeyProperty != null && !entity.ContainsKey(rowKeyProperty))
200200
writer.WriteString(rowKeyProperty, entity.RowKey);
201201

202-
if (entity.Timestamp != null)
202+
if (entity.Timestamp != null && !entity.ContainsKey(nameof(ITableEntity.Timestamp)))
203203
writer.WriteString(nameof(ITableEntity.Timestamp), entity.Timestamp.Value.ToString("O"));
204204

205205
foreach (var property in entity)

0 commit comments

Comments
 (0)