Skip to content

Commit

Permalink
Merge branch 'system.text.json' of https://github.com/riganti/dotvvm
Browse files Browse the repository at this point in the history
…into system.text.json
  • Loading branch information
tomasherceg committed Nov 3, 2024
2 parents 91e03b6 + 32bafde commit 20019bf
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected virtual MemberInfo[] ResolveShadowing(Type type, MemberInfo[] members)
protected virtual IEnumerable<ViewModelPropertyMap> GetProperties(Type type, MethodBase? constructor)
{
var ctorParams = constructor?.GetParameters().ToDictionary(p => p.Name.NotNull(), StringComparer.OrdinalIgnoreCase);

var properties = type.GetAllMembers(BindingFlags.Public | BindingFlags.Instance)
.Where(m => m is PropertyInfo or FieldInfo)
.ToArray();
Expand All @@ -175,10 +175,11 @@ protected virtual IEnumerable<ViewModelPropertyMap> GetProperties(Type type, Met
if (property is FieldInfo)
{
// fields are ignored by default, unless marked with [Bind(not None)], [JsonInclude] or defined in ValueTuple<...>
include = include ||
include = include && (
!(bindAttribute is null or { Direction: Direction.None }) ||
property.IsDefined(typeof(JsonIncludeAttribute)) ||
(type.IsGenericType && type.FullName!.StartsWith("System.ValueTuple`"));
(type.IsGenericType && type.FullName!.StartsWith("System.ValueTuple`"))
);
}
if (!include) continue;

Expand Down

0 comments on commit 20019bf

Please sign in to comment.