/// <summary> /// Adds a data object to the data store. /// </summary> /// <param name="parser">The input template parser.</param> /// <param name="dataObject">The data object to be added.</param> public override void Add(WitsmlQueryParser parser, Log dataObject) { using (var transaction = GetTransaction()) { transaction.SetContext(dataObject.GetUri()); // Add ChannelSets + data via the ChannelSet data adapter foreach (var childParser in parser.ForkProperties("ChannelSet", ObjectTypes.ChannelSet)) { var channelSet = WitsmlParser.Parse <ChannelSet>(childParser.Root); ChannelSetDataAdapter.Add(childParser, channelSet); } // Clear ChannelSet data properties foreach (var channelSet in dataObject.ChannelSet) { channelSet.Data = null; } InsertEntity(dataObject); // Commit transaction transaction.Commit(); } }
/// <summary> /// Adds a data object to the data store. /// </summary> /// <param name="parser">The input template parser.</param> /// <param name="dataObject">The data object to be added.</param> public override void Add(WitsmlQueryParser parser, Log dataObject) { // Add ChannelSets + data via the ChannelSet data adapter foreach (var childParser in parser.ForkProperties("ChannelSet", ObjectTypes.ChannelSet)) { var channelSet = WitsmlParser.Parse <ChannelSet>(childParser.Root); ChannelSetDataAdapter.Add(childParser, channelSet); } // Clear ChannelSet data properties foreach (var channelSet in dataObject.ChannelSet) { channelSet.Data = null; } InsertEntity(dataObject); }