Description
Currently IMauiInitializeScopedServices only initializes once at the application level against the root provider
|
scopedContext.InitializeScopedServices(); |
This is somewhat confusing because right now IMauiInitializeScopedService, and IMauiInitializeService, aren't super different. The main differences I can see are that the IServiceProvider passed into IMauiInitializeScopedServices is a WrappedServiceProvider that will return the PlatformApplication when requested and it's initialized slightly later in the life cycle (probably not at a point that's different enough to matter).
Not sure the exact approach we want to take here long term. A couple thoughts
- Can we just get rid of the
WrappedServiceProvider at the Application level so that IMauiInitializeScopedServices and IMauiInitializeService are basically symmetrical and then we just obsolete IMauiInitializeScopedServices ?
- Does it make sense to have an
IMauiInitializeScopedServices that we call from MakeWindowScope? We already have a window factory that users can register against which would pretty much cover a scoped initialization.
Description
Currently
IMauiInitializeScopedServicesonly initializes once at the application level against the root providermaui/src/Core/src/MauiContextExtensions.cs
Line 44 in 3944004
This is somewhat confusing because right now
IMauiInitializeScopedService, andIMauiInitializeService, aren't super different. The main differences I can see are that theIServiceProviderpassed intoIMauiInitializeScopedServicesis aWrappedServiceProviderthat will return thePlatformApplicationwhen requested and it's initialized slightly later in the life cycle (probably not at a point that's different enough to matter).Not sure the exact approach we want to take here long term. A couple thoughts
WrappedServiceProviderat the Application level so thatIMauiInitializeScopedServicesandIMauiInitializeServiceare basically symmetrical and then we just obsoleteIMauiInitializeScopedServices?IMauiInitializeScopedServicesthat we call fromMakeWindowScope? We already have a window factory that users can register against which would pretty much cover a scoped initialization.