src/BeatPulse/Core/BeatPulseContext.cs
/// <summary>
/// Add a new liveness into the <see cref="BeatPulseContext"/>
/// </summary>
/// <param name="registration">The liveness registration to be added.</param>
/// <returns><see cref="BeatPulseContext"/></returns>
Add a new liveness into the
Add a new liveness into the
public BeatPulseContext AddLiveness(IBeatPulseLivenessRegistration registration)
        {
            if (registration == null)
            {
                throw new ArgumentNullException(nameof(registration));
            }
            var path = registration.Path;
            if (!string.IsNullOrEmpty(path))
            {
                if (!_registeredLiveness.ContainsKey(path))
                {
                    _registeredLiveness.Add(path, new List<IBeatPulseLivenessRegistration>() { registration });
                }
                else
                {
                    _registeredLiveness[path].Add(registration);
                }
                return this;
            }
            else
            {
                throw new InvalidOperationException("The global path is automatically used for beat pulse.");
            }
        }
public BeatPulseContext AddLiveness ( IBeatPulseLivenessRegistration registration ) { if ( registration == null ) { throw new ArgumentNullException ( nameof ( registration ) ) ; } var path = registration . Path ; if ( ! string . IsNullOrEmpty ( path ) ) { if ( ! _registeredLiveness . ContainsKey ( path ) ) { _registeredLiveness . Add ( path , new List < IBeatPulseLivenessRegistration > ( ) { registration } ) ; } else { _registeredLiveness [ path ] . Add ( registration ) ; } return this ; } else { throw new InvalidOperationException ( " " ) ; } }
Add a new liveness into the
Add a new liveness into the
None
registration
IBeatPulseLivenessRegistration
The liveness registration to be added.
The liveness registration to be added .