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
<PackageReference Include="Net4x.ZipCodesLibrary" Version="2.0.0.26283" />
<PackageVersion Include="Net4x.ZipCodesLibrary" Version="2.0.0.26283" />
<PackageReference Include="Net4x.ZipCodesLibrary" />
paket add Net4x.ZipCodesLibrary --version 2.0.0.26283
#r "nuget: Net4x.ZipCodesLibrary, 2.0.0.26283"
#:package Net4x.ZipCodesLibrary@2.0.0.26283
#addin nuget:?package=Net4x.ZipCodesLibrary&version=2.0.0.26283
#tool nuget:?package=Net4x.ZipCodesLibrary&version=2.0.0.26283
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
NonSoloCaprun walks every Italian CAP and takes hours. Runs are resumable: re-running continues past the highest CAP already inCapComuniunless a drop/truncate flag is set. - Column and table names are Italian, matching the domain.
| Product | Versions 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. |
-
.NETFramework 4.6.1
- Net4x.BrowserLibrary (>= 2.0.0.26283)
- Net4x.HtmlPersist (>= 2.0.0.26283)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
- Selenium.Support (>= 4.13.1)
- Selenium.WebDriver (>= 4.13.1)
- Selenium.WebDriver.ChromeDriver (>= 127.0.6533.11900)
-
net5.0-windows7.0
- Net4x.BrowserLibrary (>= 2.0.0.26283)
- Net4x.HtmlPersist (>= 2.0.0.26283)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
- Selenium.Support (>= 4.13.1)
- Selenium.WebDriver (>= 4.13.1)
- Selenium.WebDriver.ChromeDriver (>= 127.0.6533.11900)
-
net6.0-windows7.0
- Net4x.BrowserLibrary (>= 2.0.0.26283)
- Net4x.HtmlPersist (>= 2.0.0.26283)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
- Selenium.Support (>= 4.13.1)
- Selenium.WebDriver (>= 4.13.1)
- Selenium.WebDriver.ChromeDriver (>= 127.0.6533.11900)
-
net7.0-windows7.0
- Net4x.BrowserLibrary (>= 2.0.0.26283)
- Net4x.HtmlPersist (>= 2.0.0.26283)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
- Selenium.Support (>= 4.13.1)
- Selenium.WebDriver.ChromeDriver (>= 127.0.6533.11900)
-
net8.0-windows7.0
- Net4x.BrowserLibrary (>= 2.0.0.26283)
- Net4x.HtmlPersist (>= 2.0.0.26283)
- Net4x.WindowsFormsLibrary (>= 2.0.0.26250)
- Selenium.Support (>= 4.13.1)
- Selenium.WebDriver.ChromeDriver (>= 127.0.6533.11900)
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 | 68 | 10/11/2026 |
| 2.0.0.26238 | 110 | 8/27/2026 |
| 1.3.0.2 | 160 | 1/6/2026 |
| 1.3.0 | 246 | 4/4/2025 |