Exemple #1
0
        /// <summary>
        /// Comparison implementation that compares keys.  Version numbers
        /// are not factored into equality comparisons.
        /// </summary>
        /// <param name="obj">The model identifier to compare to.</param>
        /// <returns><c>true</c> if the <see cref="ModelId{T}"/>s are considered equal;
        /// otherwise <c>false</c> is returned.</returns>
        public bool Equals(ModelId <T> obj)
        {
            // If parameter is null return false.
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }

            // If these are the same references then return true.
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            // Match on the individual fields.
            return(obj.ModelKey.Equals(ModelKey));
        }
Exemple #2
0
 /// <summary>
 /// Constructs a new model identifier with the <paramref name="modelId"/>'s internal key
 /// and the given <paramref name="versionNumber"/>.
 /// </summary>
 /// <param name="modelId">The model identifier to copy.</param>
 /// <param name="versionNumber">The version number associated with this new model identifier.</param>
 public ModelId(ModelId <T> modelId, int versionNumber)
     : this(modelId.ModelKey, versionNumber)
 {
 }
Exemple #3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="modelId">The model identifier to copy.</param>
 public ModelId(ModelId <T> modelId)
     : this(modelId.ModelKey, modelId.VersionNumber)
 {
 }