Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Add culture constructor to RouteValueProvider #5812

Merged
merged 1 commit into from Feb 16, 2017

Conversation

ryanbrandenburg
Copy link
Contributor

Fixes #5336 using a similar format to ElementalValueProvider.

/// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param>
/// <param name="values">The values.</param>
/// <param name="culture">The culture for route value.</param>
public RouteValueProvider(BindingSource bindingSource, RouteValueDictionary values, CultureInfo culture)
Copy link
Member

Choose a reason for hiding this comment

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

Please add to the docs for the other constructor that it will use the InvariantCulture.

@@ -52,6 +69,8 @@ protected PrefixContainer PrefixContainer
}
}

protected CultureInfo Culture { get; } = CultureInfo.InvariantCulture;
Copy link
Member

Choose a reason for hiding this comment

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

The general pattern when you have an optional constructor argument is to have the shorter constructor overload call the longer one and pass in the default value that way, rather than setting it directly on a property.

While this will work, it's going to catch someone out who's reading the code.

@@ -21,10 +21,11 @@ public class RouteValueProvider : BindingSourceValueProvider
/// </summary>
/// <param name="bindingSource">The <see cref="BindingSource"/> of the data.</param>
/// <param name="values">The values.</param>
/// <remarks>Sets Culture to CultureInfo.InvariantCulture.</remarks>
Copy link
Member

Choose a reason for hiding this comment

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

Use <see...>

@ryanbrandenburg ryanbrandenburg force-pushed the rybrande/CultureOnRouteValueProvider branch from ef46a0e to f667a7d Compare February 16, 2017 18:41
@ryanbrandenburg ryanbrandenburg force-pushed the rybrande/CultureOnRouteValueProvider branch from caf5b48 to 366dbde Compare February 16, 2017 22:50
@ryanbrandenburg ryanbrandenburg merged commit 366dbde into dev Feb 16, 2017
@ryanbrandenburg ryanbrandenburg deleted the rybrande/CultureOnRouteValueProvider branch February 16, 2017 23:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants