Skip to content

Commit

Permalink
refactor: use WithCount table variant
Browse files Browse the repository at this point in the history
  • Loading branch information
rikdepeuter authored and ArneD committed May 28, 2024
1 parent 3fb9574 commit 168719d
Show file tree
Hide file tree
Showing 8 changed files with 357 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ParcelRegistry.Api.Extract.Extracts
namespace ParcelRegistry.Api.Extract.Extracts
{
using System.Collections.Generic;
using System.Linq;
Expand All @@ -14,7 +14,7 @@ public class ParcelRegistryLinkExtractBuilder
public static IEnumerable<ExtractFile> CreateParcelFiles(ExtractContext context)
{
var extractItems = context
.ParcelLinkExtract
.ParcelLinkExtractWithCount
.AsNoTracking();

var parcelProjectionState = context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<ParcelResponseWithEtag> Handle(ParcelDetailRequest request, Ca
{
var parcel =
await _context
.ParcelDetailV2
.ParcelDetailWithCountV2
.Include(x => x.Addresses)
.AsNoTracking()
.SingleOrDefaultAsync(item => item.CaPaKey == request.CaPaKey, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ namespace ParcelRegistry.Api.Legacy.Parcel.List
using Be.Vlaanderen.Basisregisters.Api.Search;
using Be.Vlaanderen.Basisregisters.Api.Search.Filtering;
using Be.Vlaanderen.Basisregisters.Api.Search.Sorting;
using Be.Vlaanderen.Basisregisters.GrAr.Common;
using Be.Vlaanderen.Basisregisters.GrAr.Legacy.Perceel;
using Microsoft.EntityFrameworkCore;
using Convertors;
using Microsoft.EntityFrameworkCore;
using ParcelRegistry.Projections.Legacy;
using ParcelRegistry.Projections.Legacy.ParcelDetailV2;
using ParcelRegistry.Projections.Legacy.ParcelDetailWithCountV2;

public class ParcelListV2Query : Query<ParcelListV2QueryItem, ParcelFilter>
{
Expand All @@ -24,7 +23,7 @@ public class ParcelListV2Query : Query<ParcelListV2QueryItem, ParcelFilter>
protected override IQueryable<ParcelListV2QueryItem> Filter(FilteringHeader<ParcelFilter> filtering)
{
var parcels = _context
.ParcelDetailV2
.ParcelDetailWithCountV2
.AsNoTracking()
.OrderBy(x => x.CaPaKey)
.Where(x => !x.Removed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<ParcelDetailOsloResponseWithEtag> Handle(ParcelDetailOsloReque
{
var parcel =
await _context
.ParcelDetailV2
.ParcelDetailWithCountV2
.Include(x => x.Addresses)
.AsNoTracking()
.SingleOrDefaultAsync(item => item.CaPaKey == request.CaPaKey, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ParcelRegistry.Api.Oslo.Parcel.List
using Convertors;
using Microsoft.EntityFrameworkCore;
using Projections.Legacy;
using Projections.Legacy.ParcelDetailV2;
using Projections.Legacy.ParcelDetailWithCountV2;

public class ParcelListOsloV2Query : Query<ParcelListV2QueryItem, ParcelFilter>
{
Expand All @@ -23,7 +23,7 @@ public class ParcelListOsloV2Query : Query<ParcelListV2QueryItem, ParcelFilter>
protected override IQueryable<ParcelListV2QueryItem> Filter(FilteringHeader<ParcelFilter> filtering)
{
var parcels = _context
.ParcelDetailV2
.ParcelDetailWithCountV2
.AsNoTracking()
.OrderBy(x => x.CaPaKey)
.Where(x => !x.Removed);
Expand Down
7 changes: 1 addition & 6 deletions src/ParcelRegistry.Projections.Legacy/LegacyContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ namespace ParcelRegistry.Projections.Legacy
using Microsoft.EntityFrameworkCore;
using ParcelDetailV2;
using ParcelSyndication;
using ParcelDetailAddressWithCountV2 = ParcelDetailWithCountV2.ParcelDetailAddressV2;
using ParcelDetailWithCount = ParcelDetailWithCountV2.ParcelDetailV2;



public class LegacyContext : RunnerDbContext<LegacyContext>
{
public override string ProjectionStateSchema => Schema.Legacy;
Expand All @@ -17,9 +15,6 @@ public class LegacyContext : RunnerDbContext<LegacyContext>
public DbSet<ParcelDetailV2.ParcelDetailV2> ParcelDetailV2 { get; set; }
public DbSet<ParcelDetailWithCount> ParcelDetailWithCountV2 { get; set; }

public DbSet<ParcelDetailAddressV2> ParcelAddressesV2 { get; set; }
public DbSet<ParcelDetailAddressWithCountV2> ParcelAddressesWithCountV2 { get; set; }

public DbSet<ParcelSyndicationItem> ParcelSyndication { get; set; }

public DbSet<ParcelDetailV2ListViewCount> ParcelDetailV2ListViewCount { get; set; }
Expand Down
Loading

0 comments on commit 168719d

Please sign in to comment.