internal OAirport GetOrDefault(string icao) { VatmapContext db = (VatmapContext)this.serviceProvider.GetService(typeof(VatmapContext)); OAirport ret; if (this.proxy.TryGetValue(icao, out ret) == false) { DAirport tmp = db.Airport.FirstOrDefault(q => q.Icao == icao); if (tmp != null) { ret = new OAirport() { City = tmp.City, Country = tmp.Country, ICAO = tmp.Icao, Name = tmp.Name, Gps = new Gps() { Latitude = tmp.Latitude, Longitude = tmp.Longitude } }; } else { ret = new OAirport() { City = "", Country = "", Name = icao, ICAO = icao, Gps = null }; } this.proxy[ret.ICAO] = ret; } return(ret); }
internal DAirport Get(string icao) { DAirport ret = this.db.Airport.FirstOrDefault(q => q.Icao == icao); return(ret); }