feat(infrastructure): add EF Core context and repository implementations

This commit is contained in:
2026-10-10 11:18:27 +02:00
parent 1fbcc2d197
commit 88456e7f87
5 changed files with 287 additions and 1 deletions

View File

@@ -0,0 +1,111 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace DigitalData.TaskFlow.Infrastructure.Persistence.Models;
/// <summary>
/// Represents a stored procedure row shape for workflow listing data.
/// </summary>
public sealed class WorkflowListingReadModel
{
/// <summary>
/// Gets or sets the process identifier.
/// </summary>
[Column("processid")]
public int ProcessId { get; set; }
/// <summary>
/// Gets or sets the profile identifier.
/// </summary>
[Column("profileid")]
public int ProfileId { get; set; }
/// <summary>
/// Gets or sets the voucher type.
/// </summary>
[Column("belegart")]
public string VoucherType { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the voucher number.
/// </summary>
[Column("belegnr")]
public string VoucherNumber { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the voucher date.
/// </summary>
[Column("belegdatum")]
public DateTime VoucherDate { get; set; }
/// <summary>
/// Gets or sets the cost center.
/// </summary>
[Column("kostenstelle")]
public string CostCenter { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the cost center description.
/// </summary>
[Column("kostenstellenbezeichnung")]
public string CostCenterDescription { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the client number.
/// </summary>
[Column("mandantnr")]
public int ClientNumber { get; set; }
/// <summary>
/// Gets or sets the client name.
/// </summary>
[Column("mandantbez")]
public string ClientName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the supplier number.
/// </summary>
[Column("lieferantnr")]
public string SupplierNumber { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the supplier name.
/// </summary>
[Column("lieferantbez")]
public string SupplierName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the net amount.
/// </summary>
[Column("netto")]
public double NetAmount { get; set; }
/// <summary>
/// Gets or sets the gross amount.
/// </summary>
[Column("brutto")]
public double GrossAmount { get; set; }
/// <summary>
/// Gets or sets the discount amount.
/// </summary>
[Column("skontobetrag")]
public double DiscountAmount { get; set; }
/// <summary>
/// Gets or sets the currency.
/// </summary>
[Column("waehrung")]
public string Currency { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the priority.
/// </summary>
[Column("priority")]
public int Priority { get; set; }
/// <summary>
/// Gets or sets the source group text.
/// </summary>
[Column("GROUP_TEXT")]
public string GroupText { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,26 @@
using DigitalData.TaskFlow.Infrastructure.Persistence.Models;
using Microsoft.EntityFrameworkCore;
namespace DigitalData.TaskFlow.Infrastructure.Persistence;
/// <summary>
/// EF Core DbContext for TaskFlow infrastructure data access.
/// </summary>
public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> options) : DbContext(options)
{
/// <summary>
/// Gets the keyless result model used for workflow listing procedure reads.
/// </summary>
public DbSet<WorkflowListingReadModel> WorkflowListingReadModels => Set<WorkflowListingReadModel>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<WorkflowListingReadModel>(entity =>
{
entity.HasNoKey();
entity.ToView(null);
});
}
}