-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add remapping extensions for core #17918
Conversation
Hi @PureWeen. We have added the "s/pr-needs-author-input" label to this issue, which indicates that we have an open question/action for you before we can take further action. This PRwill be closed automatically in 14 days if we do not hear back from you by then - please feel free to re-open it if you come back to this PR after that time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is much better - and I am 60% sure that changing the return type is both breaking but not really.
public static void ModifyMapping<TVirtualView, TViewHandler>(this IPropertyMapper<TVirtualView, TViewHandler> propertyMapper, | ||
#pragma warning disable RS0016 // Add public types and members to the declared API | ||
public static IPropertyMapper<TVirtualView, TViewHandler> ModifyMapping<TVirtualView, TViewHandler>(this IPropertyMapper<TVirtualView, TViewHandler> propertyMapper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this is breaking... I think methods can't be overloaded just by return type, so this may actually work. I'll test and report back.
[nameof(ISwipeView.TopItems)] = MapTopItems, | ||
[nameof(ISwipeView.RightItems)] = MapRightItems, | ||
[nameof(ISwipeView.BottomItems)] = MapBottomItems, | ||
public static IPropertyMapper<ISwipeView, ISwipeViewHandler> Mapper = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an alternative that we could do and not have more extension methods:
public static IPropertyMapper Mapper = new()
{
[nameof(Xxx)] = MapXxx,
}
.Remap(mapper =>
{
mapper.ModifyMapping(xxx, yyy);
mapper.ReplaceMapping(xxx, yyy);
});
Chill out, robot - we're thinking. |
I have this open PR: My PR might be blocked on this draft PR. But if mine is completed first, I'll comment here that its fix needs to be adjusted. |
Description of Change
This PR adds a set of extension methods that we can use to
ReMap
mapper delegates inside core. This models the remapping mechanisms that we've already added to controls. Various scenarios come up where we just want to inject some additional logic into a subclassed handler but we still want the code from the base handler to run. This also ensures that if the user has replaced logic at theViewHandler
level, it will continue to run.TODO
Issues Fixed
#17665