WI01087620: Add reflection-free protected static API for ZBindingContext net10 compatibility#25
Open
DerekDong666 wants to merge 1 commit into
Open
WI01087620: Add reflection-free protected static API for ZBindingContext net10 compatibility#25DerekDong666 wants to merge 1 commit into
DerekDong666 wants to merge 1 commit into
Conversation
…ext net10 compatibility ZBindingContext (CargoWise) rewires how related CurrencyManagers subscribe to their parent's change events, driving children from CurrentChanged with CargoWise-specific policy instead of the default CurrentItemChanged handler. On .NET Framework it did this by reflecting over RelatedCurrencyManager internals. On .NET 10 those internals changed (field renamed, flags refactored) so reflection no longer works. Add a set of reflection-free protected static helpers on BindingContext so that the subclass in the external assembly can reach the necessary internal state: BindingContext: - GetParentCurrencyManager: returns the CurrencyManager driving a RelatedCurrencyManager child - DetachRelatedManagerFromParentItemChanged: detaches the default CurrentItemChanged subscription - RefreshRelatedManagerFromParent: triggers the child to refresh from the parent's current row - ResetRelatedManagerToEmptyList(IList): resets child to a safe empty placeholder list and raises position/current events, bypassing the AddNew/CancelCurrentEdit appcompat path that executes AddNew on a real business-object collection when the parent is empty - RaiseCurrentItemChangedSuppressingPushData: raises CurrentItemChanged with PushData suppressed; replaces reflection of the removed suspendPushDataInCurrentChanged field RelatedCurrencyManager (internal helpers backing the above): - ParentCurrencyManager property - DetachParentItemChangedHandler() - RefreshFromParentCurrent() - ResetToEmptyList(IList) CurrencyManager: - RaiseCurrentItemChangedSuppressingPushData(EventArgs): toggles _state flag directly Remove the now-superseded RewireParentChangeHandler / RewireRelatedCurrencyManagerParent pair. Update PublicAPI.Unshipped.txt accordingly. Companion change in WiseTechGlobal/CargoWise consumes these helpers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds reflection-free \protected static\ helpers on \BindingContext\ so that \ZBindingContext\ (CargoWise) can rewire related \CurrencyManager\ parent subscriptions on .NET 10 without reflecting over internals that changed since .NET Framework.
Context
\ZBindingContext\ is a \BindingContext\ subclass in an external assembly (no \InternalsVisibleTo). It needs to:
Previously these were done via reflection. On .NET 10, _parentManager\ (renamed from \parentManager) and removal of \suspendPushDataInCurrentChanged\ in favour of _state\ flags broke the reflection approach.
Changes
*\RelatedCurrencyManager* — 4 new \internal\ members:
*\CurrencyManager* — 1 new \internal\ method:
*\BindingContext* — replaces \RewireRelatedCurrencyManagerParent\ with 5 \protected static\ facade helpers:
*\PublicAPI.Unshipped.txt* — removes old \RewireRelatedCurrencyManagerParent\ entry, registers the 5 new helpers.
Companion change: CargoWise PR #54869