|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.Globalization; |
4 | 3 | using System.IO; |
5 | 4 | using System.Linq; |
6 | 5 | using System.Reflection; |
7 | 6 | using System.Text; |
8 | 7 | using System.Threading; |
9 | | -using ServiceStack.Reflection; |
10 | 8 | using ServiceStack.Text.Common; |
11 | 9 | using ServiceStack.Text.Jsv; |
12 | | -using ServiceStack.Text.Pools; |
13 | 10 |
|
14 | 11 | namespace ServiceStack.Text |
15 | 12 | { |
@@ -241,7 +238,7 @@ public static WriteObjectDelegate WriteFn() |
241 | 238 |
|
242 | 239 | private const string IgnoreResponseStatus = "ResponseStatus"; |
243 | 240 |
|
244 | | - private static Func<object, object> valueGetter = null; |
| 241 | + private static GetMemberDelegate valueGetter = null; |
245 | 242 | private static WriteObjectDelegate writeElementFn = null; |
246 | 243 |
|
247 | 244 | private static WriteObjectDelegate GetWriteFn() |
@@ -305,15 +302,15 @@ private static WriteObjectDelegate GetWriteFn() |
305 | 302 | //If is DTO and has an enumerable property serialize that |
306 | 303 | if (bestCandidateEnumerableType != null) |
307 | 304 | { |
308 | | - valueGetter = bestCandidate.GetValueGetter(typeof(T)); |
| 305 | + valueGetter = bestCandidate.CreateGetter(); |
309 | 306 | var elementType = bestCandidateEnumerableType.GenericTypeArguments()[0]; |
310 | 307 | writeElementFn = CreateWriteFn(elementType); |
311 | 308 |
|
312 | 309 | return WriteEnumerableProperty; |
313 | 310 | } |
314 | 311 |
|
315 | 312 | //If is DTO and has non-enumerable, reference type property serialize that |
316 | | - valueGetter = firstCandidate.GetValueGetter(typeof(T)); |
| 313 | + valueGetter = firstCandidate.CreateGetter(); |
317 | 314 | writeElementFn = CreateWriteRowFn(firstCandidate.PropertyType); |
318 | 315 |
|
319 | 316 | return WriteNonEnumerableType; |
@@ -396,7 +393,7 @@ public static ParseStringDelegate ReadFn() |
396 | 393 | return ReadCacheFn; |
397 | 394 | } |
398 | 395 |
|
399 | | - private static Action<object, object> valueSetter = null; |
| 396 | + private static SetMemberDelegate valueSetter = null; |
400 | 397 | private static ParseStringDelegate readElementFn = null; |
401 | 398 |
|
402 | 399 | private static ParseStringDelegate GetReadFn() |
@@ -460,15 +457,15 @@ private static ParseStringDelegate GetReadFn() |
460 | 457 | //If is DTO and has an enumerable property serialize that |
461 | 458 | if (bestCandidateEnumerableType != null) |
462 | 459 | { |
463 | | - valueSetter = bestCandidate.GetValueSetter(typeof(T)); |
| 460 | + valueSetter = bestCandidate.CreateSetter(); |
464 | 461 | var elementType = bestCandidateEnumerableType.GenericTypeArguments()[0]; |
465 | 462 | readElementFn = CreateReadFn(elementType); |
466 | 463 |
|
467 | 464 | return ReadEnumerableProperty; |
468 | 465 | } |
469 | 466 |
|
470 | 467 | //If is DTO and has non-enumerable, reference type property serialize that |
471 | | - valueSetter = firstCandidate.GetValueSetter(typeof(T)); |
| 468 | + valueSetter = firstCandidate.CreateSetter(); |
472 | 469 | readElementFn = CreateReadRowFn(firstCandidate.PropertyType); |
473 | 470 |
|
474 | 471 | return ReadNonEnumerableType; |
|
0 commit comments