Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Options include setting for Culture #139

Merged
merged 9 commits into from
Apr 6, 2021

Conversation

axunonb
Copy link
Member

@axunonb axunonb commented Mar 25, 2021

Closes #80

  • Serialization and de-serialization can be culture-specific
  • Fully compatible with v2.x (using CultureInfo.InvariantCulture as the default setting)
  • Limitation: Serialization and de-serialization must use the same culture setting

Breaking changes to v2.x (added CultureInfo parameter):

  • ReflectionUtils.ConvertBasicType(object value, Type dstType, CultureInfo culture)
  • XMLUtilts.ToXmlValue(this object self, CultureInfo culture)
  • XMLUtilts.CreateAttribute(XElement baseElement, string location, XName attrName, object attrValue, XNamespace documentDefaultNamespace, CultureInfo culture)
  • XMLUtilts.AddPreserveSpaceAttribute(XElement element, CultureInfo culture)
  • XMLUtilts.ToXmlValue(this object self, CultureInfo culture)
  • XMLUtilts.AddAttributeNamespaceSafe(this XElement parent, XName attrName, object attrValue, XNamespace documentDefaultNamespace, CultureInfo culture)
  • XMLUtilts.AddXmlContent(this XElement self, object contentValue, CultureInfo culture)

Open for discussion:

  • Should Exceptions use CultureInfo.InvariantCulture, CultureInfo.CurrentCulture or Options.Culture. The latter is complex with no value IMHO.
  • Should utility classes (like mentioned as breaking changes) rather be internal than public?
  • Is the Limitation above acceptable? Of course must become part of the docs (know the consequences leaving defaults or alike)

@axunonb axunonb changed the title Option for culture info Option includes setting for Culture Mar 25, 2021
@axunonb axunonb changed the title Option includes setting for Culture Options include setting for Culture Mar 25, 2021
@axunonb
Copy link
Member Author

axunonb commented Mar 25, 2021

@304NotModified @NKnusperer Opinion on #139 (comment) appreciated

@304NotModified
Copy link
Collaborator

Nice PRs! Will try to review this weekend!

@axunonb axunonb added this to the v3 milestone Mar 28, 2021
@axunonb axunonb marked this pull request as ready for review March 28, 2021 22:03
@axunonb
Copy link
Member Author

axunonb commented Apr 5, 2021

@304NotModified @NKnusperer
Would be great if you found few minutes for the open for discussion part or review in general ;-)

@304NotModified
Copy link
Collaborator

304NotModified commented Apr 5, 2021

Open for discussion:

  • Should Exceptions use CultureInfo.InvariantCulture, CultureInfo.CurrentCulture or Options.Culture. The latter is complex with no value IMHO.

CultureInfo.InvariantCultureorCultureInfo.CurrentCulture` looks good to me.

  • Should utility classes (like mentioned as breaking changes) rather be internal than public?

Yes those should be internal

  • Is the Limitation above acceptable? Of course must become part of the docs (know the consequences leaving defaults or alike)

Sounds logical to me :)

Assert.IsTrue(ser.DimensionsAttributeName == opt.AttributeName.Dimensions);
Assert.IsTrue(ser.RealTypeAttributeName == opt.AttributeName.RealType);
Assert.IsTrue(ser.MaxRecursion == opt.MaxRecursion);
ser.DefaultExceptionType.Should().Be(opt.ExceptionBehavior);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 nice

@NKnusperer
Copy link
Collaborator

@axunonb I'am in vacation till the end of the week. I will try to catch up next week.

@axunonb axunonb merged commit ff5d8b2 into YAXLib:master Apr 6, 2021
@axunonb axunonb deleted the Option-for-CultureInfo branch April 6, 2021 20:32
@304NotModified
Copy link
Collaborator

@NKnusperer have a good holiday!

@axunonb
Copy link
Member Author

axunonb commented Apr 16, 2021

@NKnusperer Hi, hope you some beautiful days off ;-)
Did have a look at #139 (comment) already?
Especially: public classes / methods which had better become internal. A major release were a good opportunity for that, but we have to be careful about the right approach.

@NKnusperer
Copy link
Collaborator

NKnusperer commented Apr 19, 2021

Should Exceptions use CultureInfo.InvariantCulture, CultureInfo.CurrentCulture or Options.Culture. The latter is complex with no value IMHO.

With exceptions you're talking about the message?
If so, values that are internally treated as culture-invariant should use CultureInfo.InvariantCulture and vice versa.

Should utility classes (like mentioned as breaking changes) rather be internal than public?

Yes.

Is the Limitation above acceptable? Of course must become part of the docs (know the consequences leaving defaults or alike)

Absolutely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants