public Guid?GetRequestId(TInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            return(_requestIdProperty.Get(instance));
        }
        Task <State <TInstance> > StateAccessor <TInstance> .Get(InstanceContext <TInstance> context)
        {
            var stateName = _property.Get(context.Instance);

            if (string.IsNullOrWhiteSpace(stateName))
            {
                return(Task.FromResult <State <TInstance> >(null));
            }

            return(Task.FromResult(_machine.GetState(stateName)));
        }
示例#3
0
        Task <State <TInstance> > StateAccessor <TInstance> .Get(InstanceContext <TInstance> context)
        {
            State state = _property.Get(context.Instance);

            if (state == null)
            {
                return(Task.FromResult <State <TInstance> >(null));
            }

            return(Task.FromResult(_machine.GetState(state.Name)));
        }
示例#4
0
        public Guid? GetRequestId(TInstance instance)
        {
            if (instance == null)
                throw new ArgumentNullException(nameof(instance));

            return _requestIdProperty != null
                ? _requestIdProperty.Get(instance)
                : instance.CorrelationId;
        }
示例#5
0
        public void Should_be_able_to_access_a_private_setter()
        {
            var instance = new PrivateSetter();

            PropertyInfo property = instance.GetType()
                                            .GetProperties(BindingFlags.Instance | BindingFlags.Public)
                                            .Where(x => x.Name == "Name")
                                            .First();

            var fastProperty = new ReadWriteProperty<PrivateSetter>(property, true);

            const string expectedValue = "Chris";
            fastProperty.Set(instance, expectedValue);

            Assert.AreEqual(expectedValue, fastProperty.Get(instance));
        }
示例#6
0
        public void Should_be_able_to_access_a_private_setter()
        {
            var instance = new PrivateSetter();

            var property = instance
                           .GetType()
                           .GetProperties(BindingFlags.Instance | BindingFlags.Public)
                           .First(x => x.Name == "Name");


            var fastProperty = new ReadWriteProperty <PrivateSetter>(property);

            const string expectedValue = "Chris";

            fastProperty.Set(instance, expectedValue);

            Assert.AreEqual(expectedValue, fastProperty.Get(instance));
        }
        void Execute(Composer composer, TInstance instance)
        {
            composer.Execute(() =>
            {
                CompositeEventStatus value = _property.Get(instance);
                value.Set(_flag);

                _property.Set(instance, value);

                if (!value.Equals(_complete))
                {
                    return(composer.ComposeCompleted());
                }

                var taskComposer = new TaskComposer <TInstance>(composer.CancellationToken);

                _completeCallback(taskComposer, instance);

                return(taskComposer.Finish());
            });
        }
        Task <State <TInstance> > StateAccessor <TInstance> .Get(InstanceContext <TInstance> context)
        {
            var stateIndex = _property.Get(context.Instance);

            return(Task.FromResult(_index[stateIndex]));
        }
示例#9
0
 public CompositeEventStatus Get(TInstance instance)
 {
     return(_property.Get(instance));
 }
示例#10
0
 public Guid?GetTokenId(TInstance instance)
 {
     return(_tokenIdProperty.Get(instance));
 }