Beispiel #1
0
        public static InBinding FromOutKey(string fieldKey, string outKey)
        {
            var ib = new InBinding();

            ib.FieldKey  = fieldKey;
            ib.Generator = (ctx) => { return(ctx.In(outKey)); };
            return(ib);
        }
Beispiel #2
0
        public static InBinding FromConstantValue(string fieldKey, object value)
        {
            var ib = new InBinding();

            ib.FieldKey  = fieldKey;
            ib.Generator = (ctx) => { return(value); };
            return(ib);
        }
Beispiel #3
0
        public ChainTask Set(string fieldKey, object value)
        {
            if (GetInField(fieldKey) == null)
            {
                throw new ArgumentException($"Field({fieldKey}) not exists in Task({GetType()}).");
            }

            InBindings.Add(InBinding.FromConstantValue(fieldKey, value));
            return(this);
        }
Beispiel #4
0
        public static InBinding FromTemplate <TEMPLATE>(string fieldKey, params object[] args)
            where TEMPLATE : IMessageTemplate
        {
            var ib       = new InBinding();
            var template = (TEMPLATE)Activator.CreateInstance(typeof(TEMPLATE), args);

            ib.FieldKey  = fieldKey;
            ib.Generator = (ctx) => { return(template.OnExecute(ctx)); };
            return(ib);
        }
Beispiel #5
0
        public ChainTask In(string fieldKey, string outKey)
        {
            if (GetInField(fieldKey) == null)
            {
                throw new ArgumentException($"Field({fieldKey}) not exists in Task({GetType()}).");
            }

            InBindings.Add(InBinding.FromOutKey(fieldKey, outKey));
            return(this);
        }
Beispiel #6
0
        public ChainTask In <TEMPLATE>(string fieldKey, params object[] args)
            where TEMPLATE : IMessageTemplate
        {
            if (GetInField(fieldKey) == null)
            {
                throw new ArgumentException($"Field({fieldKey}) not exists in Task({GetType()}).");
            }

            InBindings.Add(InBinding.FromTemplate <TEMPLATE>(fieldKey, args));
            return(this);
        }