/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { #if !NET20 if (objectType.AssignableToTypeName(BinaryTypeName)) return true; #endif return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { #if !SILVERLIGHT && !PocketPC && !NET20 if (objectType.AssignableToTypeName(BinaryTypeName)) return true; #endif #if !SILVERLIGHT if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?)) return true; #endif return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { #if !NET20 if (objectType.AssignableToTypeName(BinaryTypeName)) { return true; } #endif if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?)) { return true; } return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { return objectType.AssignableToTypeName(EntityKeyMemberFullTypeName); }
/// <summary> /// Gets the serializable members for the type. /// </summary> /// <param name="objectType">The type to get serializable members for.</param> /// <returns>The serializable members for the type.</returns> protected virtual List<MemberInfo> GetSerializableMembers(Type objectType) { #if !PocketPC && !NET20 DataContractAttribute dataContractAttribute = JsonTypeReflector.GetDataContractAttribute(objectType); #endif List<MemberInfo> defaultMembers = ReflectionUtils.GetFieldsAndProperties(objectType, DefaultMembersSearchFlags) .Where(m => !ReflectionUtils.IsIndexedProperty(m)).ToList(); List<MemberInfo> allMembers = ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static) .Where(m => !ReflectionUtils.IsIndexedProperty(m)).ToList(); List<MemberInfo> serializableMembers = new List<MemberInfo>(); foreach (MemberInfo member in allMembers) { if (defaultMembers.Contains(member)) { // add all members that are found by default member search serializableMembers.Add(member); } else { // add members that are explicitly marked with JsonProperty/DataMember attribute if (JsonTypeReflector.GetAttribute<JsonPropertyAttribute>(member) != null) serializableMembers.Add(member); #if !PocketPC && !NET20 else if (dataContractAttribute != null && JsonTypeReflector.GetAttribute<DataMemberAttribute>(member) != null) serializableMembers.Add(member); #endif } } #if !PocketPC && !SILVERLIGHT && !NET20 Type match; // don't include EntityKey on entities objects... this is a bit hacky if (objectType.AssignableToTypeName("System.Data.Objects.DataClasses.EntityObject", out match)) serializableMembers = serializableMembers.Where(ShouldSerializeEntityMember).ToList(); #endif return serializableMembers; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { #if !SILVERLIGHT && !PocketPC && !NET20 && !__ANDROID__ if (objectType.AssignableToTypeName(BinaryTypeName)) return true; #endif #if !(SILVERLIGHT || __ANDROID__ || MONOTOUCH) if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?)) return true; #endif return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { if (objectType.AssignableToTypeName(BinaryTypeName)) return true; return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType, JsonProperty property) { return (objectType.AssignableToTypeName(EntityKeyMemberFullTypeName)); }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { #if !SILVERLIGHT && !PocketPC && !NET20 && !UNITY_WEBGL if (objectType.AssignableToTypeName(BinaryTypeName)) return true; #endif #if !(SILVERLIGHT || UNITY_WEBGL || UNITY_EDITOR || UNITY_ANDROID) if (objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?)) return true; #endif return false; }
/// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. /// </returns> public override bool CanConvert(Type objectType) { if (objectType.AssignableToTypeName(BinaryTypeName)) return true; return objectType == typeof(SqlBinary) || objectType == typeof(SqlBinary?); }
public static bool AssignableToTypeName(this Type type, string fullTypeName) { Type type2; return(type.AssignableToTypeName(fullTypeName, out type2)); }