-Added DateTimeConverterBase

-Changed class converter to be resolved from contract
-Changed built in converters to be resolved once when the contract is created. Big performance gain!
This commit is contained in:
JamesNK
2009-12-26 18:51:39 +00:00
parent f574bfbf83
commit 9144bc6c80
29 changed files with 244 additions and 133 deletions
@@ -24,12 +24,9 @@
#endregion
using System;
using System.Collections.Generic;
#if !SILVERLIGHT
using System.Data.SqlTypes;
#endif
using System.Linq;
using System.Text;
using System.Globalization;
using Newtonsoft.Json.Utilities;
@@ -135,16 +132,12 @@ namespace Newtonsoft.Json.Converters
/// </returns>
public override bool CanConvert(Type objectType)
{
Type t = (ReflectionUtils.IsNullableType(objectType))
? Nullable.GetUnderlyingType(objectType)
: objectType;
#if !SILVERLIGHT && !PocketPC && !NET20
if (t.AssignableToTypeName(BinaryTypeName))
if (objectType.AssignableToTypeName(BinaryTypeName))
return true;
#endif
#if !SILVERLIGHT
if (t == typeof(SqlBinary))
if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?))
return true;
#endif
return false;