Optimize invoice performance with indexes and DTO
Added indexes for `ImportedAt` and a composite key on `InvoiceNumber` and `SellerTaxId` to improve query performance. Updated `AppDbContext` and EF Core migrations to reflect these changes. Introduced `ZugferdInvoiceListDto` to optimize memory usage by excluding large fields like `RawXml`. Updated the frontend (`Index.cshtml`) and backend (`Index.cshtml.cs`) to use the new DTO for better performance.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace DXApp.TemplateKitProject.Migrations
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("InvoiceNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RawXml")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@@ -61,7 +61,7 @@ namespace DXApp.TemplateKitProject.Migrations
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SellerTaxId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("SourceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
@@ -74,6 +74,12 @@ namespace DXApp.TemplateKitProject.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ImportedAt")
|
||||
.HasDatabaseName("IX_ZugferdInvoices_ImportedAt");
|
||||
|
||||
b.HasIndex("InvoiceNumber", "SellerTaxId")
|
||||
.HasDatabaseName("IX_ZugferdInvoices_InvoiceNumber_SellerTaxId");
|
||||
|
||||
b.ToTable("ZugferdInvoices");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
|
||||
Reference in New Issue
Block a user