GetMetadata() приватный Метод

Gets meta-data using GEP waiting no longer than specified timeout.
private GetMetadata ( int timeout ) : DataSet
timeout int Specifies how long to wait, in milliseconds, for meta-data.
Результат System.Data.DataSet
Пример #1
0
 /// <summary>
 /// Gets meta-data from the <paramref name="connectionString" /> waiting no longer than the specified <paramref name="timeout"/>.
 /// </summary>
 /// <param name="connectionString">GEP publication host and port, e.g., "192.168.1.1:6175", to connect to for meta-data.</param>
 /// <param name="timeout">Specifies how long to wait, in milliseconds, for meta-data.</param>
 /// <returns>The meta-data received from the GEP publisher in <see cref="DataSet"/> format.</returns>
 public static DataSet GetMetadata(string connectionString, int timeout = Timeout.Infinite)
 {
     using (MetadataRetriever retriever = new MetadataRetriever(connectionString))
     {
         return(retriever.GetMetadata(timeout));
     }
 }
Пример #2
0
        public static List <Metadata> Query()
        {
            List <Metadata> measurements = new List <Metadata>();

            // Note that openHistorian internal publisher controls how many tables / fields to send as meta-data to subscribers (user controllable),
            // as a result, not all fields in associated database views will be available. Below are the default SELECT filters the publisher
            // will apply to the "MeasurementDetail", "DeviceDetail" and "PhasorDetail" database views:

            // SELECT NodeID, UniqueID, OriginalSource, IsConcentrator, Acronym, Name, AccessID, ParentAcronym, ProtocolName, FramesPerSecond, CompanyAcronym, VendorAcronym, VendorDeviceName, Longitude, Latitude, InterconnectionName, ContactList, Enabled, UpdatedOn FROM DeviceDetail WHERE IsConcentrator = 0
            // SELECT DeviceAcronym, ID, SignalID, PointTag, SignalReference, SignalAcronym, PhasorSourceIndex, Description, Internal, Enabled, UpdatedOn FROM MeasurementDetail
            // SELECT DeviceAcronym, Label, Type, Phase, SourceIndex, UpdatedOn FROM PhasorDetail
            // SELECT VersionNumber FROM SchemaVersion

            DataTable measurementTable = null;
            //DataTable deviceTable = null;
            //DataTable phasorTable = null;

            string connectionString = "server=" + MainWindow.ConnectionDialog.ServerHost.Text + ":" + MainWindow.ConnectionDialog.GEPPort.Text + "; interface=0.0.0.0";

            try
            {
                DataSet metadata = MetadataRetriever.GetMetadata(connectionString, 60000);

                // Reference meta-data tables
                measurementTable = metadata.Tables["MeasurementDetail"];
                //deviceTable = metadata.Tables["DeviceDetail"];
                //phasorTable = metadata.Tables["PhasorDetail"];
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception retrieving meta-data: " + ex.Message);
            }

            if ((object)measurementTable != null)
            {
                // Do something with measurement records
                foreach (DataRow measurement in measurementTable.Select("SignalAcronym <> 'STAT' and SignalAcronym <> 'DIGI'"))
                {
                    measurements.Add(new Metadata(measurement));
                }
            }

            return(measurements);
        }
 /// <summary>
 /// Gets meta-data from the <paramref name="connectionString" /> waiting no longer than the specified <paramref name="timeout"/>.
 /// </summary>
 /// <param name="connectionString">GEP publication host and port, e.g., "192.168.1.1:6175", to connect to for meta-data.</param>
 /// <param name="timeout">Specifies how long to wait, in milliseconds, for meta-data.</param>
 /// <returns>The meta-data received from the GEP publisher in <see cref="DataSet"/> format.</returns>
 public static DataSet GetMetadata(string connectionString, int timeout = Timeout.Infinite)
 {
     using (MetadataRetriever retriever = new MetadataRetriever(connectionString))
     {
         return retriever.GetMetadata(timeout);
     }
 }