// NOTE: this method of writing data will buffer the added items in the // sessions class and send all items when the FlushData method is called public string StoreData2() { Connect(); // create data to store DateTime now = DateTime.Now; Dictionary <string, int> tagIds = GetTagIds(); foreach (KeyValuePair <string, int> pair in tagIds) { string tagName = pair.Key; int id = pair.Value; // add tvq data for (int i = 0; i < 500; i++) { TVQ tvq = new TVQ(); tvq.id = id; tvq.timestamp = now.AddTicks(i); tvq.value = i % 100; tvq.quality = StandardQualities.Good; _session.AddTVQ(tvq); } // add property data Property highScale = new Property(); highScale.id = id; highScale.description = null; highScale.timestamp = now; highScale.name = StandardPropertyNames.ScaleHigh; highScale.value = 100; highScale.quality = StandardQualities.Good; _session.AddProperty(highScale); // add property data Property lowScale = new Property(); lowScale.id = id; lowScale.description = null; lowScale.timestamp = now; lowScale.name = StandardPropertyNames.ScaleLow; lowScale.value = 0; lowScale.quality = StandardQualities.Good; _session.AddProperty(lowScale); // add property data Property sampleInterval = new Property(); sampleInterval.id = id; sampleInterval.description = null; sampleInterval.timestamp = now; sampleInterval.name = StandardPropertyNames.SampleInterval; sampleInterval.value = TimeSpan.FromSeconds(1); sampleInterval.quality = StandardQualities.Good; _session.AddProperty(sampleInterval); // add annotation Annotation annotation = new Annotation(); annotation.id = id; annotation.timestamp = now; //annotation.createdAt = now; // only necessary if creation time differs from annotation timestamp annotation.user = "******"; annotation.value = "Example Annotation"; _session.AddAnnotation(annotation); } int storedTVQs; int storedProperties; int storedAnnotations; return(_session.FlushData(out storedTVQs, out storedProperties, out storedAnnotations)); }