Exemple #1
0
        public void CreateLocation(Location instance)
        {
            GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();

            objectContext.Locations.InsertOnSubmit(instance);
            objectContext.SubmitChanges();
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
 private void insertLocation(Location instance)
 {
     using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
     {
         objectContext.Locations.InsertOnSubmit(instance);
         objectContext.SubmitChanges();
     }
 }
 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();
            }
        }
 private void insertLocation(Location instance)
 {
     using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
     {
         objectContext.Locations.InsertOnSubmit(instance);
         objectContext.SubmitChanges();
     }
 }