private async Task<IEnumerable<IPRangeInfo>> LocateIPv6Async(IPAddress ip) { var flatIP = new FlatIPAddress(ip); using (var connection = new SqliteConnection(_connectionString)) { connection.Open(); return await connection.ExecuteReaderAsync(dataReader => { return new IPRangeInfo { IPRange = new IPRange { Start = new FlatIPAddress { Low = (long)dataReader["StartLow"], High = (long)dataReader["StartHigh"] }.ToIPAddress(), End = new FlatIPAddress { Low = (long)dataReader["EndLow"], High = (long)dataReader["EndHigh"] }.ToIPAddress(), }, AreaId = Convert.ToInt32(dataReader["AreaId"]), ProviderId = Convert.ToInt32(dataReader["ProviderId"]), }; }, @" SELECT * FROM IPRangeInfos WHERE (StartHigh < {1} OR (StartHigh = {1} AND StartLow <= {0})) AND (EndHigh > {1} OR (EndHigh = {1} AND EndLow >= {0}));", flatIP.Low, flatIP.High); } }