-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Create components using dependency injection #5497
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
Comments
I guess the designer change would need to be here: Would need to check those conditions or "is interface". I'd be glad to make the changes and make a pull request if it would be an acceptable change. Building the vsix with that change to test it should be pretty easy. What do you think? |
This works: https://github.com/scabana/Blazor/commit/4b7f303fe7b423a5a47140a7ac9b636a4d749856 |
I would like to open a pull request with my commit, I don't want to force it before getting buy-in, anyone reviewing issues? Thanks! |
We could go a step further where
|
We have no plans to do this for this release. |
From what I see, it would be changing this line: https://github.com/aspnet/Blazor/blob/5be754e75def0c4134e379a6440c6b284828f01e/src/Microsoft.AspNetCore.Blazor/Components/ComponentFactory.cs#L35
Another change would be to allow for interfaces that derives from IComponent in the language service.
The usecases are the following:
Allow for code only components to use constructor injection. The property injection support was native in Asp.Net core while it was in its early stages and was later removed to make the DI simpler and more focussed. This seems to be a step backwards.
Allow this pattern:
How would this be useful: it would become possible to expose components as a contract between multiple assemblies, potentially multiple repositories. This could become the base for a micro-ui architecture where each service could expose their UI components as a contract thus removing the need for a fully pre-built application and allowing dynamically loading components for A/B testing or for testing new features behind feature flags.
The text was updated successfully, but these errors were encountered: