Service load order

From SocialStack

Most of the time it doesn't matter which order services load in - it will be automatically established based on dependencies. Sometimes though it can be useful to give a guarantee that a service loads before other services. That can be done by setting the LoadPriority attribute on a service, like so:

using Api.Startup;
namespace Api.Things;


[LoadPriority(5)]
public partial class ThingService : AutoService<Thing>
{

}

If a load priority is not specified the default value is 10 just like with event listeners. The lower the number you give, the sooner it runs. LoadPriority(1) runs before LoadPriority(10).