Пример #1
0
 /// <summary>
 /// Establish measurement key cache based on received meta-data.
 /// </summary>
 /// <param name="metadata">Meta-data received from a subscription.</param>
 /// <param name="instanceName">Instance name of the historian.</param>
 /// <remarks>
 /// If you want the <see cref="IMeasurement.Key"/> values that are returned from a <see cref="GetHistorianData"/> query
 /// to have properly assigned Guid based signal IDs, i.e., <see cref="MeasurementKey.SignalID"/>, establish the
 /// measurement key cache as soon as you have received meta-data from a GEP subscription query.
 /// </remarks>
 public static void EstablishMeasurementKeyCache(DataSet metadata, string instanceName)
 {
     // Check to see if data for the "MeasurementDetail" table was included in the meta-data
     if (metadata.Tables.Contains("MeasurementDetail"))
     {
         // Establish default measurement key cache
         foreach (DataRow row in metadata.Tables["MeasurementDetail"].Rows)
         {
             MeasurementKey.CreateOrUpdate(Guid.Parse(row.Field <object>("SignalID").ToString()), instanceName, row.Field <uint>("PointID"));
         }
     }
 }