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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor Hybrid/web shared assets via RCL #26331
Conversation
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.
Thanks for pulling this content together, @guardrex! My main feedback is about making the content more generic and less specific to the project templates. Let me know if anything is unclear.
Let's hold off on adding an official sample for this. We may end up needing to support this scenario better in templates, which would supersede and sample.
@danroth27 ... As of this (Tuesday) morning, I've made updates to address your feedback except for the last point, which will take a little more time. I'll either have that done this afternoon or on Wednesday. It's probably best if you wait until I get the last bit done because I'd also like to edit the whole topic again. I'll ping back when ready ... probably Wednesday morning. |
@danroth27 ... Perhaps best if you DO look at the very last commit, which only contains the 2nd abstraction example ...
.... and no need to sweat any little nits (spelling, phrasing, etc.). I'll clean that stuff up tomorrow morning. I really did just type this straight in and ping u. There's no polish on this yet. As for the rest ... the commit prior to the last ... probably best to not look at that yet. I need to 馃挙馃泴馃槾 on it one night and apply a round of updates to clean up and improve it. |
|
||
When code must differ for across hosting models, abstract the code as interfaces and inject the service implementations into each project. | ||
|
||
### Example 1 |
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.
This first example shows how to deal with multiple target platforms. I think it might be simpler to start with the weather forecast service example, which shows how to deal with different hosting models, and then show the more complicated example of dealing with multiple target platforms.
I believe the Platforms folder convention is also specific to .NET MAUI class libraries that have UseMaui set to true in the project. I don't think we support setting UseMaui to true in an RCL. So you'd need to move the platform specific service implementations into a separate .NET MAUI class library.
This still leaves the question of how to package and distribute the Blazor components with the platform specific implementations. I'm not sure what we should recommend for that. @Eilon @javiercn Thoughts?
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.
start with the weather forecast service example
Done! 馃憤
The rest of your remarks are cryptic to me (e.g., I created the folders in the RCL manually), so I'll wait for more feedback on the exact actions to take.
Also, I performed general updates. The whole PR is ready for another look 馃憖.
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 talked this over with @SteveSandersonMS and we agreed to hold off on diving into the complexity of dealing with platform specific logic for now. At this point I think we should remove the 2nd example and just have the first weather forecast example.I would also like to change the weather forecast example to recommend that the IWeatherForecastService
implementations go into the corresponding Blazor apps instead of in the RCL.
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.
Updates made. ... I held the 2nd example in place in case it's used later (or it's the basis of something used later).
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.
Looks good to me!
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.
A couple of minor nits, but otherwise this looks good to me .
Co-authored-by: Daniel Roth <daroth@microsoft.com>
Fixes #26186
Addresses #26848
Internal Review Topic
Notes
dotnet/blazor-samples
repo sample of this scenario in spite of its forward maintenance costs馃挵? If so, is my test app that mirrors the guidance in the PR (.NET MAUI Blazor + Blazor Server) what you'd like to showcase?