Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
HybridServiceProvider.cs
2{
11 public class HybridServiceProvider(IServiceProvider fallbackProvider) : IServiceProvider
12 {
13 private readonly IServiceProvider fallbackProvider = fallbackProvider;
14
21 public object? GetService(Type serviceType)
22 {
23 // Prefer the built DI container so constructor injection is honored, then fall back to the inventory.
24 object? Service = this.fallbackProvider.GetService(serviceType);
25 if (Service is not null)
26 return Service;
27
28 return Waher.Runtime.Inventory.Types.Instantiate(true, serviceType);
29 }
30
31
32 }
33}
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:15
static object Instantiate(Type Type, params object[] Arguments)
Returns an instance of the type Type . If one needs to be created, it is. If the constructor requires...
Definition: Types.cs:1454
Definition: App.xaml.cs:4