public LocationForecasts(SolradNwpForecast forecast) { var coordinateFactory = new CoordinateFactory(forecast.Srid); Location = coordinateFactory.CreatePoint(forecast.Latitude, forecast.Longitude); Latitude = forecast.Latitude; Longitude = forecast.Longitude; Srid = forecast.Srid; Created = forecast.Created; Modified = forecast.Modified; Forecasts = forecast.Forecasts.Select(f => new DbSolradForecast(this, f)).ToList(); }
public ulong IngestSingle(SolradNwpForecast ingested, SolarRadiationDataContext dbContext, ulong count, bool saveChanges = true) { var location = new LocationForecasts(ingested); dbContext.Locations.Add(location); if (saveChanges) { dbContext.SaveChanges(); foreach (var f in dbContext.Forecasts) { f.LocationForecastId = location.Id; } dbContext.SaveChanges(); } return(count + 1); }