I using Fluent migrator 3.3.2, which throws error on one of databases:
The error was Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I was looking for how to set timeout option and found this post https://github.com/fluentmigrator/fluentmigrator/discussions/1472
But runner.RunnerContext
is marked as obsolete and in there is no comment what I have to use instead. If I try to use it like runner.RunnerContext.Timeout = Timeout.Infinite;
then have error:
Migration exception: "Object reference not set to an instance of an object."
Nothing found in google
You can set global timeout on dependency injection
var serviceProvider = new ServiceCollection()
.AddFluentMigratorCore()
.ConfigureRunner(rb => rb
.AddSqlServer()
//here
.WithGlobalCommandTimeout(TimeSpan.FromSeconds(120))
.WithGlobalConnectionString(tenant.ConnectionString)
.ScanIn(typeof(ApplicationDbContext).Assembly).For.Migrations())
.Configure<RunnerOptions>(opt => { opt.Tags = new[] { tenant.Id }; })
.AddLogging(lb => lb.AddFluentMigratorConsole())
.AddLogging(lb => lb.AddSerilog())
.BuildServiceProvider(validateScopes: false);