コード例 #1
0
        /// <summary>
        /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.AbstractObject"/>  and parentUri.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="parentUri">The parent URI.</param>
        /// <returns>An <see cref="EtpUri"/> instance</returns>
        public static EtpUri GetUri(this Witsml200.AbstractObject entity, EtpUri parentUri)
        {
            // Remove query string parameters, if any
            var uri = parentUri.GetLeftPart();

            if (!IsRootUri(uri))
            {
                // Remove trailing separator
                uri = uri.TrimEnd('/');
            }

            return(new EtpUri(uri)
                   .Append(ObjectTypes.GetObjectType(entity), entity.Uuid));
        }
コード例 #2
0
ファイル: ObjectTypes.cs プロジェクト: nilsbenson/witsml
 /// <summary>
 /// Gets the type of the object.
 /// </summary>
 /// <param name="dataObject">The data object.</param>
 /// <returns>The WITSML data object type, as a string.</returns>
 public static string GetObjectType(Witsml200.AbstractObject dataObject)
 {
     return(GetObjectType(dataObject.GetType()));
 }
コード例 #3
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.AbstractObject"/>.
 /// </summary>
 /// <param name="entity">The <see cref="Energistics.DataAccess.WITSML200.AbstractObject"/> entity.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUri(this Witsml200.AbstractObject entity)
 {
     return(entity.GetUriFamily()
            .Append(ObjectTypes.GetObjectType(entity), entity.Uuid));
 }
コード例 #4
0
 /// <summary>
 /// Gets the <see cref="EtpUri"/> for a given <see cref="Energistics.DataAccess.WITSML200.AbstractObject"/> entity.
 /// </summary>
 /// <param name="entity">The <see cref="Energistics.DataAccess.WITSML200.AbstractObject"/> entity.</param>
 /// <returns>An <see cref="EtpUri"/> instance.</returns>
 public static EtpUri GetUriFamily(this Witsml200.AbstractObject entity)
 {
     return(GetUriFamily(entity?.GetType()));
 }
コード例 #5
0
 private string GetName(Witsml200.AbstractObject entity)
 {
     return(entity == null ? string.Empty : entity.Citation.Title);
 }
コード例 #6
0
 /// <summary>
 /// Gets the last changed date time in microseconds.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns>The last changed date time in microseconds.</returns>
 public static long GetLastChangedMicroseconds(this Witsml200.AbstractObject entity)
 {
     return(entity?.Citation?.LastUpdate?.ToUnixTimeMicroseconds() ?? 0);
 }