//****************************************************************************************************** // ClientInfo.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 10/19/2010 - Pinal C. Patel // Generated original version of source code. // 11/24/2010 - Pinal C. Patel // Updated ConnectedAt to use UTC time. // 12/20/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System; using System.Runtime.Serialization; using System.ServiceModel; namespace GSF.ServiceBus { /// /// Represents information about a client connected to the to produce/consume s. /// [DataContract] public class ClientInfo { #region [ Members ] // Fields /// /// Gets or sets the session identifier of the client. /// [DataMember] public string SessionId; /// /// Gets or sets the UTC when the client connected to the . /// [DataMember] public DateTime ConnectedAt; /// /// Gets or sets the total number of s produced by the client. /// [DataMember] public long MessagesProduced; /// /// Gets or sets the total number of s consumed by the client. /// [DataMember] public long MessagesConsumed; /// /// Gets or sets the object of the client. /// public OperationContext OperationContext; #endregion #region [ Constructors ] /// /// Initializes a new instance of the class. /// /// An object of the client. internal ClientInfo(OperationContext context) { SessionId = context.SessionId; ConnectedAt = DateTime.UtcNow; OperationContext = context; } #endregion #region [ Methods ] /// /// Determines if the specified is equal to the current object. /// /// The to compare with the current object. /// true if both s are equal; otherwise false. public override bool Equals(object obj) { ClientInfo other = obj as ClientInfo; return (other != null && other.SessionId == this.SessionId); } /// /// Gets a hash value for the current object. /// /// An value. public override int GetHashCode() { return SessionId.GetHashCode(); } #endregion } }