Closed danroth27 closed 5 years ago
[Addition] If someone can give me some guidance I'll volunteer to update the page...
[Addition] Blazor doesn't currently have the concept of DI scopes. Scoped behaves like Singleton. Therefore, prefer Singleton and avoid Scoped.
is no longer correct with SSR
Hello @MarkStega ... To submit updates to the topic, do this ...
@rstropek Do you have any remarks about what @MarkStega has posted above :point_up: before he gets started with updates?
[Addition]
Blazor doesn't currently have the concept of DI scopes. Scoped behaves like Singleton. Therefore, prefer Singleton and avoid Scoped.
is no longer correct with SSR
This is not even not correct, it's diametral wrong!
@springy76 It's in progress :point_right: https://github.com/aspnet/Blazor.Docs/pull/308
The release of 2.2 slowed things down a bit. We should be picking up some steam with Blazor/Razor Components shortly.
Issue has been moved to aspnet/Docs.
From @MarkStega on August 11, 2018 14:32
If I follow the pattern shown in the Blazor DI documentation and have two services, RestBaseService & RestProcessService that have an injection of
then I can't have a constructor injection that refers to RestBaseService; it has to refer to IRestBaseService like this
If I try that same constructor with RestBaseService an error is thrown saying that that type can not be resolved.
If I change the service registration to just reference the class
then I can use the class name in constructors. Then in BrowserServiceProvider.cs I see yet another form of service registration that appears to add explicit instances to the services collection
All said, I think that the DI documentation page needs a little beefing up to explain the different scenarios because if you follow its guidance now the outcome is poor.
Copied from original issue: aspnet/Blazor#1297