public void CreateLocation(Location instance) { GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext(); objectContext.Locations.InsertOnSubmit(instance); objectContext.SubmitChanges(); }
private void readAndSaveJsonData(GZipStream inputStream) { StreamReader streamReader = null; try { streamReader = new StreamReader(inputStream); String jsonLine = null; while ((jsonLine = streamReader.ReadLine()) != null) { //get geoLocation object JObject geoLocation = JObject.Parse(jsonLine); //create entry object. Entry entry = createEntry(geoLocation); //create location object. Location location = createAndInsertLocation(geoLocation, entry); //Data object JObject jsonIdentifierObj = (JObject)geoLocation["identifier"]; Object obj = createAndInsertDataWithContent(jsonIdentifierObj, (String)geoLocation["data"], entry); //save objects into database. using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext()) { objectContext.Entries.InsertOnSubmit(entry); objectContext.SubmitChanges(); } } } finally { streamReader.Close(); } }
public List <Location> GetLocations() { GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext(); List <Location> locationQuery = (from loc in objectContext.Locations select loc).ToList(); return(locationQuery); }
private void insertLocation(Location instance) { using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext()) { objectContext.Locations.InsertOnSubmit(instance); objectContext.SubmitChanges(); } }
public Location GetLocation(string id) { int parseId = int.Parse(id); GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext(); Location location = (from loc in objectContext.Locations where loc.id == parseId select loc).First(); return(location); }
public Location GetLocation(string id) { int parseId = int.Parse(id); GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext(); Location location = (from loc in objectContext.Locations where loc.id == parseId select loc).First(); return location; }
public List<Location> GetLocations() { GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext(); List<Location> locationQuery = (from loc in objectContext.Locations select loc).ToList(); return locationQuery; }