private static void LoadAllTransectsFromDataSource() { using (FeatureDataReader data = FeatureSource.GetDataReader(new QueryFilter(), EditState.Original)) { while (data.Read()) { var transect = new Transect(); //If we can't load a transect for some reason (i.e bad geometry, missing values, duplicate name), then skip it try { transect.LoadAttributes(data); Transects[transect.Name] = transect; } catch (ArgumentException) { //Most likely a database schema error, rethrow, so UI can alert user. throw; } catch (Exception ex) { Trace.TraceError("Read a bad transect. Error Message: {0}", ex.Message); } } } }
internal static TrackLog FromTransect(Transect transect) { if (transect == null) throw new ArgumentNullException("transect"); //May throw an exception, but should never return null var trackLog = FromFeature(MobileUtilities.CreateNewFeature(FeatureSource)); trackLog.Transect = transect; return trackLog; }