• SieraDeltaGeoIp.Plugin

SieraDeltaGeoIp.Plugin

Assembly: SieraDeltaGeoIp.Plugin

Description

SieraDelta GeoIp plugin module provides access to GeoIp data from a custom, self hosted data source using the following databases:

GeoIp

SieraDelta GeoIp is mutually exclusive with the GeoIp.Plugin module, you can not use both. Both implement the IGeoIpDataService interface.

Settings

Settings to select the provider and individual provider settings are available using the GeoIpPluginSettings class.

How it Works

SieraDelta works slightly differently from the GeoIp.Plugin module, as data is stored within a local database you can choose to load all data into memory when the site is initialised, or alternatively you can load a select list of individual, most commonly used countries. You can of course choose to query the database for each request so it fits within the needs of individual sites.

How to use

SieraDelta GeoIp plugin will be loaded by the plugin manager if it is used, otherwise you can manually add the GeoIp service as follows:

services.UseSieraDeltaGeoIpService();

Useage

if (LoadGeoIpService() && 
    _geoIpInstance.GetIPAddressDetails(e.IPAddress, out string countryCodeout string region, 
        out string cityNameout decimal latitudeout decimal longitudeout long ipUniqueId))
{
    e.IPUniqueID = ipUniqueId;
    e.Latitude = latitude;
    e.Longitude = longitude;
    e.CityName = cityName;
    e.CountryCode = countryCode;
    e.Region = region;
}
else
{
    e.CountryCode = "ZZ";
    e.CityName = "Unknown";
    e.Region = String.Empty;
    e.Latitude = 0;
    e.Longitude = 0;
}