AddressProviderFramework.Implementations.Ptt 1.0.3

dotnet add package AddressProviderFramework.Implementations.Ptt --version 1.0.3
NuGet\Install-Package AddressProviderFramework.Implementations.Ptt -Version 1.0.3
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="AddressProviderFramework.Implementations.Ptt" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AddressProviderFramework.Implementations.Ptt --version 1.0.3
#r "nuget: AddressProviderFramework.Implementations.Ptt, 1.0.3"
#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.
// Install AddressProviderFramework.Implementations.Ptt as a Cake Addin
#addin nuget:?package=AddressProviderFramework.Implementations.Ptt&version=1.0.3

// Install AddressProviderFramework.Implementations.Ptt as a Cake Tool
#tool nuget:?package=AddressProviderFramework.Implementations.Ptt&version=1.0.3

AddressProviderFramework

Simple address provider framework and PTT(Turkish Post) implementation written on NetCore 2.2. When implemented it turns into a basic one-way in-memory database for addresses.

You can easily add your own implementations, and you can share them with me so I can display here!

NuGet Packages

AddressProviderFramework https://www.nuget.org/packages/AddressProviderFramework

PTT(Turkish Post) Implementation https://www.nuget.org/packages/AddressProviderFramework.Implementations.Ptt

Usage example

var repo = new PttAddressProviderRepository();
repo.Initialize("pk_2019_01_14.xlsx");

// Get the first country
var country = repo.GetCountries().First();
var states = repo.GetStates(country.Name);

foreach(var state in states)
{
    Console.WriteLine(state);
}

Console.ReadLine();

output

How to use

The PTT(Turkish Post) implementation for AddressProviderFramework, uses xslx file to populate data. You can get the latest xlsx file from http://postakodu.ptt.gov.tr/Dosyalar/pk_list.zip

Because it uses a file to populate data, you don't need any other data source. It loads data on Initialize() method, by given data file. If you are leveraging DI, it should be added to the services layer as a singleton service.

// Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddSingleton<IAddressProviderRepository, PttAddressProviderRepository>(serviceProvider =>
        {
            var repo = new PttAddressProviderRepository();
            repo.Initialize(filePath);
            return repo;
        });
}

How to implement new providers

You can simply include the NuGet package, then implement the IAddressProviderRepository however you'd like. You can always use any data source.

Third party packages

In PTT implementation, there's an excel reader package used ExcelDataReader. You can find it on https://github.com/ExcelDataReader/ExcelDataReader.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 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
1.0.3 1,614 1/20/2019
1.0.2 677 1/18/2019
1.0.1 689 1/18/2019
1.0.0 663 1/18/2019