不践迹,亦不入于室
需要在 HttpApi.Host 的OnApplicationInitialization方法下配置
AsyncHelper.RunSync(async () => { using (var scope = context.ServiceProvider.CreateScope()) { await scope.ServiceProvider .GetRequiredService<IDataSeeder>() .SeedAsync(); } });