Refactor synchronization provider selection in Program.cs

Rearranged the order in which synchronization providers are processed and removed some unnecessary empty lines. Specifically, moved the "File" case above the "Noop" case to optimize the synchronization provider selection process, as "File" is expected to be a more common use case.
This commit is contained in:
Sipke Schoorstra 2024-03-30 21:59:23 +01:00
parent ee2fdbe698
commit c7481b2e64

View file

@ -137,7 +137,7 @@ services
ef.UsePostgreSql(cockroachDbConnectionString!);
else
ef.UseSqlite(sqliteConnectionString);
ef.RunMigrations = runEFCoreMigrations;
});
@ -146,8 +146,8 @@ services
if (useMemoryStores)
management.UseWorkflowInstances(feature => feature.WorkflowInstanceStore = sp => sp.GetRequiredService<MemoryWorkflowInstanceStore>());
if(useMassTransit)
if (useMassTransit)
management.UseMassTransitDispatcher();
})
.UseWorkflowRuntime(runtime =>
@ -167,7 +167,7 @@ services
ef.UsePostgreSql(cockroachDbConnectionString!);
else
ef.UseSqlite(sqliteConnectionString);
ef.RunMigrations = runEFCoreMigrations;
});
@ -213,10 +213,11 @@ services
var database = connectionMultiplexer.GetDatabase();
return new RedisDistributedSynchronizationProvider(database);
}
case "Noop":
return new NoopDistributedSynchronizationProvider();
default:
case "File":
return new FileDistributedSynchronizationProvider(new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "locks")));
case "Noop":
default:
return new NoopDistributedSynchronizationProvider();
}
};
})
@ -282,7 +283,7 @@ services
ef.UsePostgreSql(cockroachDbConnectionString!);
else
ef.UseSqlite(sqliteConnectionString);
ef.RunMigrations = runEFCoreMigrations;
});
}