Exemplo n.º 1
0
        /// <summary>
        /// Updates the instance.
        /// </summary>
        /// <param name="objectUpdate">The object update.</param>
        /// <returns>IPureObject.</returns>
        /// <autogeneratedoc />
        public virtual IPureObject UpdateInstance(IPureObject objectUpdate)
        {
            if (objectUpdate == null)
            {
                throw new ArgumentNullException(nameof(objectUpdate));
            }

            if (ObjectId.Equals(objectUpdate.ObjectId))
            {
                if (objectUpdate.ObjectVersion > ObjectVersion)
                {
                    Logger?.LogTrace("IPureObject:UpdateInstance: ");
                    ObjectVersion = objectUpdate.ObjectVersion;
                }

                IncrementObjectVersion();
                ModifiedTimestamp = DateTimeOffset.Now;
            }
            else
            {
                Logger?.LogDebug("UpdateInstance called when {CurObjectId} != {UpdateObjectId}", ObjectId,
                                 objectUpdate.ObjectId);
            }

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compares to.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns>System.Int32.</returns>
        /// <exception cref="ArgumentException">Object must be of type DeviceBase.</exception>
        /// <autogeneratedoc />
        public override int CompareTo(IPureObject other)
        {
            if (other == null)
            {
                return(1);
            }

            if (!(other is DeviceBase))
            {
                throw new ArgumentException("Object must be of type DeviceBase.");
            }

            return(CompareTo((DeviceBase)other));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Compares to.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns>System.Int32.</returns>
 /// <autogeneratedoc />
 public override int CompareTo(IPureObject other)
 {
     return(CompareTo((PureObjectBaseTest)other));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Compares to.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns>System.Int32.</returns>
 /// <autogeneratedoc />
 public int CompareTo(IPureObject other)
 {
     return(Value.CompareTo(other));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Compares to.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns>System.Int32.</returns>
 /// <autogeneratedoc />
 public virtual int CompareTo(IPureObject other)
 {
     return(other == null ? 1 : ObjectId.CompareTo(other.ObjectId));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Determines whether [is same object version] [the specified object other].
 /// </summary>
 /// <param name="objectOther">The object other.</param>
 /// <returns><c>true</c> if [is same object version] [the specified object other]; otherwise, <c>false</c>.</returns>
 /// <autogeneratedoc />
 public bool IsSameObjectVersion(IPureObject objectOther) =>
 objectOther != null && ObjectVersion == objectOther.ObjectVersion;
Exemplo n.º 7
0
 /// <summary>
 /// Determines whether [is same object identifier] [the specified object other].
 /// </summary>
 /// <param name="objectOther">The object other.</param>
 /// <returns><c>true</c> if [is same object identifier] [the specified object other]; otherwise, <c>false</c>.</returns>
 /// <autogeneratedoc />
 public bool IsSameObjectId(IPureObject objectOther) =>
 objectOther != null && ObjectId.Equals(objectOther.ObjectId);