feat(infrastructure): add DB options and workflow close outcome evaluation

This commit is contained in:
2026-10-10 16:12:17 +02:00
parent be41adc0f3
commit b6aec7a16b
4 changed files with 171 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Infrastructure.Options;
using DigitalData.TaskFlow.Infrastructure.Persistence;
using DigitalData.TaskFlow.Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
@@ -12,6 +13,7 @@ public static class DependencyInjection
public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
{
var connectionString = configuration.GetConnectionString("TaskFlowDb");
var databaseOptions = configuration.GetSection(DatabaseOptions.SectionName).Get<DatabaseOptions>() ?? new DatabaseOptions();
if (string.IsNullOrWhiteSpace(connectionString))
{
@@ -20,9 +22,14 @@ public static class DependencyInjection
services.AddDbContext<TaskFlowDbContext>(options =>
{
options.UseSqlServer(connectionString);
options.UseSqlServer(connectionString, sqlOptions =>
{
sqlOptions.CommandTimeout(databaseOptions.CommandTimeoutSeconds);
});
});
services.Configure<DatabaseOptions>(configuration.GetSection(DatabaseOptions.SectionName));
services.AddScoped<IWorkflowRepository, WorkflowRepository>();
services.AddScoped<IDocumentRepository, DocumentRepository>();