Skip to content

Commit

Permalink
Merge pull request #71 from digocesar/wcf-ignore-data-member
Browse files Browse the repository at this point in the history
Ignore IgnoreDataMember attribute
  • Loading branch information
SafeerH authored May 31, 2024
2 parents c02a4d3 + e2dd0ba commit c847af3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/csharp-models-to-json/ModelCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ private static Model CreateModel(TypeDeclarationSyntax node)
private static bool IsIgnored(SyntaxList<AttributeListSyntax> propertyAttributeLists) =>
propertyAttributeLists.Any(attributeList =>
attributeList.Attributes.Any(attribute =>
attribute.Name.ToString().Equals("JsonIgnore")));
attribute.Name.ToString().Equals("JsonIgnore") ||
attribute.Name.ToString().Equals("IgnoreDataMember")));

private static bool IsAccessible(SyntaxTokenList modifiers) => modifiers.All(modifier =>
modifier.ToString() != "const" &&
Expand Down
3 changes: 3 additions & 0 deletions lib/csharp-models-to-json_test/ModelCollector_test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public class A : IController<Controller>
[JsonIgnore]
public string Ignored { get; set; }
[IgnoreDataMember]
public string Ignored2 { get; set; }
public void AMember()
{
}
Expand Down

0 comments on commit c847af3

Please sign in to comment.