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
<PackageReference Include="AddressProviderFramework.Implementations.Ptt" Version="1.0.3" />
paket add AddressProviderFramework.Implementations.Ptt --version 1.0.3
#r "nuget: AddressProviderFramework.Implementations.Ptt, 1.0.3"
// 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();
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 | Versions 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. |
-
.NETCoreApp 2.2
- AddressProviderFramework (>= 1.0.5)
- ExcelDataReader (>= 3.4.2)
- System.Text.Encoding.CodePages (>= 4.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.