public static AdresMatchItem Create(
     AdresMatchScorableItem scorableItem,
     BuildingContext buildingContext,
     AddressMatchContext addressMatchContext,
     ResponseOptions responseOptions)
 {
     return(new AdresMatchItem
     {
         Identificator = scorableItem.Identificator,
         Detail = scorableItem.Detail,
         Gemeente = scorableItem.Gemeente,
         Straatnaam = scorableItem.Straatnaam,
         AdresStatus = scorableItem.AdresStatus,
         Postinfo = scorableItem.Postinfo,
         HomoniemToevoeging = scorableItem.HomoniemToevoeging,
         Huisnummer = scorableItem.Huisnummer,
         Busnummer = scorableItem.Busnummer,
         PositieGeometrieMethode = scorableItem.PositieGeometrieMethode,
         AdresPositie = scorableItem.AdresPositie,
         PositieSpecificatie = scorableItem.PositieSpecificatie,
         VolledigAdres = scorableItem.VolledigAdres,
         OfficieelToegekend = scorableItem.OfficieelToegekend,
         Score = scorableItem.Score,
         AdresseerbareObjecten = buildingContext
                                 .BuildingUnits
                                 .Include(x => x.Addresses)
                                 .Where(x => x.Addresses.Any(y => y.AddressId == scorableItem.AddressId) &&
                                        !x.IsRemoved &&
                                        x.IsBuildingComplete &&
                                        x.IsComplete &&
                                        x.PersistentLocalId.HasValue)
                                 .Select(x => new { x.PersistentLocalId })
                                 .ToList()
                                 .Select(matchLatestItem => new AdresseerbaarObject
         {
             ObjectId = matchLatestItem.PersistentLocalId.ToString(),
             ObjectType = ObjectType.Gebouweenheid,
             Detail = string.Format(
                 responseOptions.GebouweenheidDetailUrl,
                 matchLatestItem.PersistentLocalId.ToString()),
         })
                                 .ToList()
                                 .Concat(
             addressMatchContext.ParcelAddressMatchLatestItems
             .Where(x => x.AddressId == scorableItem.AddressId && !x.IsRemoved)
             .ToList()
             .Select(matchLatestItem => new AdresseerbaarObject
         {
             ObjectId = matchLatestItem.ParcelPersistentLocalId,
             ObjectType = ObjectType.Perceel,
             Detail = string.Format(
                 responseOptions.PerceelDetailUrl,
                 matchLatestItem.ParcelPersistentLocalId),
         })
             .ToList())
                                 .ToList()
     });
 }
Пример #2
0
 public CrabKadRrService(IMemoryCache memoryCache, ILatestQueries latestQueries, AddressMatchContext context)
     : base(memoryCache)
 {
     _latestQueries = latestQueries;
     _context       = context;
 }
 public CachedLatestQueriesDecorator(IMemoryCache memoryCache, AddressMatchContext context)
     : base(memoryCache)
 {
     _context = context;
 }