Esempio n. 1
0
        protected void UpdateState(object state)
        {
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state));
            }

            if (state.GetType() != StateType)
            {
                throw new ArgumentException($"State must be type: '{StateType.FullName}'.", nameof(state));
            }

            if (Completed)
            {
                throw new InvalidOperationException("Instance has been completed.");
            }

            _stateProvider.UpdateInstanceState(InstanceId, state);
            State = state;
        }