You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
changed the title
Support blazor .net 9
Support subscription to states injected via primary constructors
Jan 3, 2025
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:
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.
The text was updated successfully, but these errors were encountered: