Skip to content

Allow private constructors when using ctor attribute - #530

Merged
AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
Alxandr:feat/priv-ctor
Aug 5, 2019
Merged

AArnott merged 2 commits into
MessagePack-CSharp:masterfrom
Alxandr:feat/priv-ctor

Conversation

@Alxandr

@Alxandr Alxandr commented Jul 26, 2019 •

Copy link
Copy Markdown
Contributor

The idea here is that adding SerializationConstructor attribute to a constructor is such an explicit action/flag, that it should override any priv/nonpriv solver constraint. I would argue that the same should be the case for Key attribute and similar as well, because adding [Key(0)] to something and having it ignored because it's private is confusing. But regardless, that you can at least work around. Private constructors don't work at all as is.

I would also really like a [MessagePackObject(IgnoreByDefault = true)], so I don't have to keep doing [IgnoreMember] on all the public API. Thoughts?

Closes #40

@AArnott AArnott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @neuecc?

@neuecc

neuecc commented Aug 5, 2019

Copy link
Copy Markdown
Member

Yes, I think it's a good fix.
Thank you.

@AArnott AArnott added this to the v2.0 milestone Aug 5, 2019
@AArnott
AArnott merged commit 75cd68c into MessagePack-CSharp:master Aug 5, 2019
@Alxandr
Alxandr deleted the feat/priv-ctor branch August 5, 2019 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support private constructor, members

3 participants