Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4f45a3d

Browse files
committed
Merge pull request #420 from icelorrio/Ignore-Json.Net-JsonIgnoreAttribute-Members
Add JsonIgnoreMember
2 parents b997b83 + d4728bc commit 4f45a3d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ServiceStack.Text/ReflectionExtensions.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ public static PropertyInfo[] GetPublicProperties(this Type type)
633633

634634
public const string DataMember = "DataMemberAttribute";
635635
public const string IgnoreDataMember = "IgnoreDataMemberAttribute";
636+
public const string JsonIgnoreMembar = "JsonIgnoreAttribute";
636637

637638
public static PropertyInfo[] GetSerializableProperties(this Type type)
638639
{
@@ -647,8 +648,12 @@ public static PropertyInfo[] GetSerializableProperties(this Type type)
647648

648649
// else return those properties that are not decorated with IgnoreDataMember
649650
return publicReadableProperties
650-
.Where(prop => prop.AllAttributes().All(attr => attr.GetType().Name != IgnoreDataMember))
651-
.Where(prop => !JsConfig.ExcludeTypes.Contains(prop.PropertyType))
651+
.Where( prop => prop.AllAttributes().All( attr =>
652+
{
653+
var name = attr.GetType().Name;
654+
return name != IgnoreDataMember && name != JsonIgnoreMembar;
655+
} ) )
656+
.Where( prop => !JsConfig.ExcludeTypes.Contains( prop.PropertyType ) )
652657
.ToArray();
653658
}
654659

0 commit comments

Comments
 (0)