Skip to content

Commit

Permalink
ResolveMember Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayi Peng committed Sep 8, 2022
1 parent 6d9ac62 commit 8e9ac75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LiteDB/Client/Mapper/BsonMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ protected virtual EntityMapper BuildEntityMapper(Type type)
this.ResolveMember?.Invoke(type, memberInfo, member);

// test if has name and there is no duplicate field
if (member.FieldName != null && mapper.Members.Any(x => x.FieldName.Equals(name, StringComparison.OrdinalIgnoreCase)) == false)
// when member is not ignore
if (member.FieldName != null && mapper.Members.Any(x => x.FieldName.Equals(name, StringComparison.OrdinalIgnoreCase)) == false && !member.IsIgnore)
{
mapper.Members.Add(member);
}
Expand Down
5 changes: 5 additions & 0 deletions LiteDB/Client/Mapper/MemberMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,10 @@ public class MemberMapper
/// When property is an array of items, gets underlying type (otherwise is same type of PropertyType)
/// </summary>
public Type UnderlyingType { get; set; }

/// <summary>
/// Is this property ignore
/// </summary>
public bool IsIgnore { get; set; }
}
}

0 comments on commit 8e9ac75

Please # to comment.