Net4x.ZipCodesLibrary 2.0.0.26283

dotnet add package Net4x.ZipCodesLibrary --version 2.0.0.26283
                    
NuGet\Install-Package Net4x.ZipCodesLibrary -Version 2.0.0.26283
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Net4x.ZipCodesLibrary" Version="2.0.0.26283" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.ZipCodesLibrary" Version="2.0.0.26283" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.ZipCodesLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Net4x.ZipCodesLibrary --version 2.0.0.26283
                    
#r "nuget: Net4x.ZipCodesLibrary, 2.0.0.26283"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Net4x.ZipCodesLibrary@2.0.0.26283
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Net4x.ZipCodesLibrary&version=2.0.0.26283
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.ZipCodesLibrary&version=2.0.0.26283
                    
Install as a Cake Tool

Net4x.ZipCodesLibrary

Downloads the Italian geography dataset — regions, provinces, municipalities, ZIP codes (CAP) and street level data — by scraping public sites, and persists it to SQL Server.

Built on Net4x.HtmlPersist and Net4x.BrowserLibrary.

Install

dotnet add package Net4x.ZipCodesLibrary

Target frameworks: net461, net5.0-windows, net6.0-windows, net7.0-windows, net8.0-windows. Windows only; it drives a real Chrome and shows Windows Forms progress UI.

Requirements

  • SQL Server reachable through a connection string named ConnectionString.
  • Chrome installed (chromedriver comes with the package).
<connectionStrings>
  <add name="ConnectionString"
       providerName="Microsoft.Data.SqlClient"
       connectionString="Server=localhost;Database=Italia;TrustServerCertificate=True;Trusted_Connection=True;" />
</connectionStrings>
<appSettings>
  <add key="HideBrowser" value="true" />
</appSettings>

Quick start

using ZipCodesLibrary;

var rows = await new NonSoloCap().DownloadZipCodes();

Both downloaders implement IZipDownloader and return the number of rows saved. They call SqlDapperContext.Use() themselves and create the tables they need.

Downloaders

Type Source Notes
NonSoloCap nonsolocap.it, provinces from studiomadera.it Full run: provinces → geography → CapComuni, then repairs prefixes, Belfiore codes and provinces.
CodiceInverso codiceinverso.it Per-CAP detail pages; DownloadZipCode(persister, maximized, cap, index, length) fetches a single CAP.

Tables written: Regioni, Province, Comuni, CapComuni.

When Comuni does not exist, SalvaGeografia is forced on so the geography is built before the CAP pass. Otherwise the CAP list is read from CapComuni (resuming past the highest CAP already stored) or from Comuni.

Settings

Read through ArgumentGetter — command line, appSettings or environment. Keys are in SettingsConstants.

Key Effect
HideBrowser Runs the browser hidden (maximized is its inverse).
SalvaGeografia Rebuild regions/provinces/municipalities before the CAP pass. Forced on when Comuni is missing.
SalvaRegioni Save the regions table during the geography pass.
SalvaProvince Save the provinces table during the geography pass.
DropOldTable NonSoloCap: drop CapComuni before importing.
DeleteExisting NonSoloCap: truncate CapComuni instead of dropping it.
DeleteRecreate CodiceInverso: drop CapComuni before importing.
DeleteOnly CodiceInverso: with DeleteRecreate, truncate instead of drop.
CodiceInverso CodiceInverso: run the per-CAP download pass.

Extensions

Extension class Members
DataTablePersisterExtension (on IDataTablePersister) DownloadZipCode(maximized, cap, index, length, list, onPageDownloaded) — one CAP from nonsolocap.it; sets IndexScript to this schema's CapComuni indexes.
BrowserDriverExtension (on IBrowserDriver) SalvaProvince(urls), SalvaComuniProvincia(provincia, caps)
DataTableExtension (on DataTable) ArrangeColumns(), ImpostaToponimi(rowIndex), ImpostaPreposizioni(rowIndex), MettiLocalitaDaCitta(rowIndex) — normalise scraped address columns.
RiparaExtension (on IDapperContext) RiparaPrefisso(), RiparaBelfiore(), RiparaProvince() — backfill missing columns from already-stored rows; each returns the number of rows repaired.

Caveats

  • Scrapers depend on the layout of third-party sites; a redesign upstream breaks the import.
  • A full NonSoloCap run walks every Italian CAP and takes hours. Runs are resumable: re-running continues past the highest CAP already in CapComuni unless a drop/truncate flag is set.
  • Column and table names are Italian, matching the domain.
Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net7.0-windows7.0 is compatible.  net8.0-windows was computed.  net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0.26283 78 10/11/2026
2.0.0.26238 113 8/27/2026
1.3.0.2 160 1/6/2026
1.3.0 246 4/4/2025