Search code examples
moryx

How do I execute a custom ResourceInitializer


I followed the instructions in the Template repository to create the Resources database. But now I want to use a custom ResourceInitializer to add Resources to the ResourceGraph. (see my code below)

namespace MyApplication.Resources.MyResource
{
    [ResourceInitializer(nameof(DummyInitializer))]
    public class DummyInitializer : ResourceInitializerBase
    {
        ...
    }
}

But when I go into the runtime console and execute exec ResourceManager initialize, the initializer is not shown in the list:

Output in the runtime window

How do I get the runtime to show me the DummyInitializer?


Solution

  • The Initializers you see in the console, are the ones configured in the resource managers initializer collection. In the MaintenanceWeb you can add an entry for your initializer under: http://localhost/maintenanceweb/#/modules/ResourceManager/configuration?path=ModuleConfig/Initializers or you can add it the underlying config file.

    {
      "Initializers": [
        {
          "PluginName": "DummyInitializer"
        }
      ]
    }
    

    Alternatively you can execute it using the resource managers console at: http://localhost/maintenanceweb/#/modules/ResourceManager/console

    I hope that helps, let me know if you need further help.