-
Notifications
You must be signed in to change notification settings - Fork 25k
Best practices article for MAUI+RCLs #36535
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
base: main
Are you sure you want to change the base?
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.
Pull request overview
This PR adds a new best practices article that guides developers on creating Razor class libraries (RCLs) that combine .NET MAUI and Blazor Hybrid functionality. The article demonstrates the recommended architectural pattern of host-agnostic design where RCLs define abstractions through interfaces, and platform-specific implementations are provided via dependency injection.
Key changes:
- Introduces comprehensive guidance on separating platform-agnostic Razor components from MAUI-specific implementations
- Provides step-by-step instructions for creating RCLs, MAUI class libraries, and integrating them in MAUI Blazor apps
- Includes practical code examples demonstrating the abstraction pattern with device info services
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| aspnetcore/blazor/hybrid/class-libraries-best-practices.md | New article explaining best practices for combining Blazor Hybrid with .NET MAUI and RCLs, including architecture patterns, code examples, and troubleshooting guidance |
| aspnetcore/toc.yml | Adds the new article to the Table of Contents under Blazor Hybrid section after the Class libraries article |
Co-authored-by: Copilot <[email protected]>
BethMassi
left a comment
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 LGTM. We should probably also link to this article from this page too: https://review.learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/reuse-razor-components
Fixes #36486
Adds the article as ...
aspnetcore/blazor/hybrid/class-libraries-best-practices.mdblazor/hybrid/class-libraries-best-practicesI versioned this at >=6.0, but I believe that at least some of the API (e.g.,
Microsoft.Maui.Devices.DeviceInfo) is >=9.0. Should the article be versioned >=9.0?Internal previews