-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rename AttributeDictionary
to AttributeValueDictionary
#107
Comments
This was resolved in 0b62fe0. |
The `AttributeDictionary` class (OnTopicCMS/OnTopic-Library#99) introduces a conflict with the `AttributeDictionary` in `Microsoft.AspNetCore.Mvc.ViewFeatures`, which is often used as a namespace in model libraries (OnTopicCMS/OnTopic-Library#107). To disambiguate this, it's been renamed to `AttributeValueDictionary`. The editor's view models have been updated to utilize this new naming convention.
The `AttributeDictionary` class (OnTopicCMS/OnTopic-Library#99) introduces a conflict with the `AttributeDictionary` in `Microsoft.AspNetCore.Mvc.ViewFeatures`, which is often used as a namespace in model libraries (OnTopicCMS/OnTopic-Library#107). To disambiguate this, it's been renamed to `AttributeValueDictionary` in OnTopic Library 5.2.0 Alpha 255 (b243853). The editor's view models have been updated to utilize this new naming convention (1ca4eb4).
Previously, `OnTopic.Attributes` couldn't be (easily) introduced as a global using directive (c9f6b17, #93) because of a naming conflict with `AttributeDictionary`, which existed in both `OnTopic.Attributes` and `Microsoft.AspNetCore.Mvc.ViewFeatures`. With `AttributeDictionary` renamed to `AttributeValueDictionary` (0b62fe0, #107), this can be reintroduced.
With `AttributeDictionary` renamed to `AttributeValueDictionary` (#107) the potential naming conflict with the out-of-the-box `AttributeValueDictionary` is removed, and we can thus (re)introduce `OnTopic.Attributes` as a global using directive, and remove the local using directives across `OnTopic` and `OnTopic.Tests` (07d46ec).
Renamed `AttributeValueDictionary` back to `AttributeDictionary`, thus reverting 38c54c3. It seems this decision was premature, and we can mitigate the naming conflicts without renaming the class, since the out-of-the-box `ViewFeatures` namespace is almost exclusively used in views, and the `AttributeDictionary` is almost exclusively used in view models. This effectively undoes #107.
Previously, `OnTopic.Attributes` couldn't be (easily) introduced as a global using directive (e37de82, 1e83841; #53, OnTopicCMS/OnTopic-Library#93) because of a naming conflict with `AttributeDictionary`, which existed in both `OnTopic.Attributes` and `Microsoft.AspNetCore.Mvc.ViewFeatures`. With `AttributeDictionary` renamed to `AttributeValueDictionary` (OnTopicCMS/OnTopic-Library#107), this can be reintroduced.
With `AttributeDictionary` renamed to `AttributeValueDictionary` (OnTopicCMS/OnTopic-Library#107) the potential naming conflict with the out-of-the-box `AttributeValueDictionary` is removed, and we can thus (re)introduce `OnTopic.Attributes` as a global using directive (0ca571a), and remove the local using directives across `OnTopic.Editor.AspNetCore.Attributes` (f87ad72).
Updated OnTopic Library to the #260 build of the `revert-AttributeValueDictionary` branch. This reverts `AttributeValueDictionary` back to `AttributeDictionary`, in preparation to undo OnTopicCMS/OnTopic-Library#107). The conflict that was trying to avoid wasn't necessary.
The latest patch renamed `AttributeValueDictionary` back to `AttributeDictionary`, thus reverting a large part of the previous patch (b243853). It seems this decision was premature, though, as we can mitigate the naming conflicts without renaming the class, since the out-of-the-box `ViewFeatures` namespace is almost exclusively used in views, and the `AttributeDictionary` is almost exclusively used in view models. This effectively undoes 1ca4eb4 and OnTopicCMS/OnTopic-Library#107.
This appears to be based on either an outdated issue or a faulty initial analysis. If I recall, the initial issue was relevant to It is conceivable that something has changed in how the .NET SDK handles global using directives with ASP.NET Core applications, thus resolving conflicts that previously existed (e.g., by exposing global using directives to Regardless, this conflict doesn't appear to be an issue, and thus we should revert this work, preferring |
Renamed `AttributeValueDictionary` back to `AttributeDictionary`, thus reverting 38c54c3. This decision was made prematurely, and we can mitigate the naming conflicts without renaming the class. This is because the out-of-the-box `ViewFeatures` namespace is almost exclusively used in views, and the `AttributeDictionary` is almost exclusively used in view models. This effectively undoes #107, while still allowing `OnTopic.Attributes` to be added as a global using directive, where appropriate.
Renamed `AttributeValueDictionary` back to `AttributeDictionary`, thus reverting cec9de4. This decision was made prematurely, and we can mitigate the naming conflicts without renaming the class. This is because the out-of-the-box `ViewFeatures` namespace is almost exclusively used in views, and the `AttributeDictionary` is almost exclusively used in view models. This effectively undoes OnTopicCMS/OnTopic-Library#107, while still allowing `OnTopic.Attributes` to be added as a global using directive, where appropriate.
There is already a class named
AttributeDictionary
inMicrosoft.AspNetCore.Mvc.ViewFeatures
namespace (reference). Unfortunately, theViewFeatures
namespace is often appropriate to introduce as a global namespace for view models. That introduces a naming conflict in the exact domain we expect to be using ourAttributeDictionary
.The
AttributeDictionary
naming convention makes perfect sense for our needs. But to disambiguate it, we may want to rename it toAttributeValueDictionary
. This isn't ideal, as it's inconsistent with most other attribute-related naming conventions in OnTopic as well as dictionary names in .NET. That said, there is at least some precedence for this in the ASP.NET Core MVCRouteValueDictionary
, which is a mapping of route parameter names to route parameter values. That's not especially convincing, but as a popular class it at least provides some familiarity or justification for this convention, instead of it being entirely arbitrary.Originally posted by @JeremyCaney in #99 (comment)
The text was updated successfully, but these errors were encountered: