Add a source generator to simplify IPopupService interaction. #3223
Saeras
started this conversation in
New Feature Discussions
Replies: 1 comment
|
Fix me if I am wrong but it is already available out of the box. The attribute already available and you only set the path as a parameter. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
With Popup V2, the design of passing data to the view model is much more cumbersome than before. Previously this would be possible by setting the properties in a type safe manner on the view model instance that is already bound to the popup instance, for example:
This same workflow is no longer type safe, and requires corresponding mappings on both the popup view model side and the view model that wishes to show the popup. This change was made for what appears to be standardization with the
IQueryAttributableinterface in the .NET MAUI Framework. Similar topics have been raised on other issues (#1733, #2693, #2696, #3029, etc.). The current workflow at this time now changes the simplicity above to:With numerous properties, the coordination between the
MainViewModelandPopupViewModelquickly becomes a maintenance nightmare, particularly ensuring the types are coordinated between theMainViewModelandPopupViewModelappropriately.I would like to propose that a source generator be created that helps coordinate the properties. For example, the
PopupViewModelcould be attributed with a[QueryAttributable]attribute which would generate theApplyQueryAttributesimplementation, and that same attribute could be used to generate some sort of extension method to display the popup using a syntax possibly similar to the originalTask<Result> ShowMyPopupAsync<Result>(this IPopupService popupService, Action<PopupViewModel> configure);All reactions