azist / azos

A to Z Sky Operating System / Microservice Chassis Framework
MIT License
213 stars 29 forks source link

`GetGdidProvider()` in DataUtils disregards `Apps.Injection.DynamicModuleFlowScope` making it impossible to add a GDID module as a dynamic reference at runtime #800

Closed itadapter closed 2 years ago

itadapter commented 2 years ago

We forgot to search for DynamicScope after app when we resolve gdid provider, here is a fix:

    /// <summary>
    /// Returns IGdidProvider
    /// </summary>
    public static IGdidProvider GetGdidProvider(this IApplication app)
    {
      //1 - search the app space
      var module = app.NonNull(nameof(app)).ModuleRoot.TryGet<IGdidProviderModule>();

      //2 - search the dynamic scope
      if (module == null)
      {
        module = Apps.Injection.DynamicModuleFlowScope.Find(typeof(IGdidProviderModule), null) as IGdidProviderModule;
      }

      module.NonNull("Required `IGdidProviderModule` module installed in app or dynamic scope");

      return module.Provider;
    }
itadapter commented 2 years ago

FIXED and tested