Skip to content
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

Support subscription to states injected via primary constructors #514

Closed
huberttrueselftrueme opened this issue Nov 20, 2024 · 2 comments
Closed
Milestone

Comments

@huberttrueselftrueme
Copy link

With .NET 9, Blazor now supports constructor injection for services, aligning with the standard approach used across other .NET technologies. From an encapsulation perspective, it's best practice to store injected services as readonly fields within a class, like so:

public class Foo
{
    private readonly IMyService service;

    public Foo(IMyService service)
    {
        this.service = service;
    }
}

However, in Fluxor, components such as FluxorComponent and FluxorLayout currently only subscribe to state properties, not fields. It would be highly beneficial if Fluxor supported state subscription via fields as well, allowing developers to follow best practices for encapsulation while leveraging Fluxor's functionality.

@iTKerry
Copy link

iTKerry commented Dec 11, 2024

Totally agree. New .NET 9 supports constructor dependency injection for Blazor. Sadly it is not supported by Fluxor. I wish there will be an update for it in future.

@mrpmorris mrpmorris changed the title Support blazor .net 9 Support subscription to states injected via primary constructors Jan 3, 2025
@mrpmorris mrpmorris added this to the 6.5 milestone Jan 3, 2025
@mrpmorris
Copy link
Owner

Fixed in 6.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants