title: How to get user IP address in API model in ASP.NET Core 2.1?
body: <p>I am not having issue getting user IP address while the code is running in web API controller but in model I am actually unable to use:</p>
  
  <pre><code>this.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
  </code></pre>
  
  <p>The reason I need need user IP because I need to geolocate its country by comparing it via data available from a third party provider. I could do this during web API controller phase but it is better to have in model, this way I can create a custom annotation to do my job as I will need to reuse the code in several models.</p>