Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ResolveMember Extension #2236

Merged
merged 1 commit into from
Nov 29, 2023
Merged

ResolveMember Extension #2236

merged 1 commit into from
Nov 29, 2023

Conversation

pjy612
Copy link

@pjy612 pjy612 commented Sep 8, 2022

support Ignore
code use like

BsonMapper.Global.ResolveMember = (Type type, MemberInfo memberInfo, MemberMapper memberMapper) =>
            {
                if (type.IsSubclassOf(typeof(EntityBase)))
                {
                    if (memberInfo.GetCustomAttributes<PrimaryKeyAttribute>().Any())
                    {
                        memberMapper.FieldName = "_id";
                    }
                    if (memberInfo.GetCustomAttributes<AutoIncrementAttribute>().Any())
                    {
                        memberMapper.AutoId = true;
                    }
                    if (memberInfo.GetCustomAttributes<IgnoreAttribute>().Any())
                    {
                        memberMapper.IsIgnore = true;
                    }
                }
            };

@mbdavid mbdavid merged commit 262415a into litedb-org:master Nov 29, 2023
@mbdavid
Copy link
Collaborator

mbdavid commented Nov 29, 2023

Hi @pjy612, thanks for your contribution. I will review all PR and release in next version your changes ;)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants