Microsoft.AspNet.SignalR.Hubs.StateChangeTracker.GetChanges C# (CSharp) Method

GetChanges() private method

private GetChanges ( ) : object>.IDictionary
return object>.IDictionary
        public IDictionary<string, object> GetChanges()
        {
            var changes = (from key in _oldValues.Keys
                           let oldValue = _oldValues[key]
                           let newValue = _values[key]
                           where !Object.Equals(oldValue, newValue)
                           select new
                           {
                               Key = key,
                               Value = newValue
                           }).ToDictionary(p => p.Key, p => p.Value);

            return changes.Count > 0 ? changes : null;
        }
    }

Usage Example

Example #1
0
        private Task ProcessResponse(StateChangeTracker tracker, object result, HubRequest request, Exception error)
        {
            var    exception    = error.Unwrap();
            string stackTrace   = (exception != null && _isDebuggingEnabled) ? exception.StackTrace : null;
            string errorMessage = exception != null ? exception.Message : null;

            if (exception != null)
            {
                _counters.ErrorsHubInvocationTotal.Increment();
                _counters.ErrorsHubInvocationPerSec.Increment();
                _counters.ErrorsAllTotal.Increment();
                _counters.ErrorsAllPerSec.Increment();
            }

            var hubResult = new HubResponse
            {
                State      = tracker.GetChanges(),
                Result     = result,
                Id         = request.Id,
                Error      = errorMessage,
                StackTrace = stackTrace
            };

            return(Transport.Send(hubResult));
        }
All Usage Examples Of Microsoft.AspNet.SignalR.Hubs.StateChangeTracker::GetChanges