public static InBinding FromOutKey(string fieldKey, string outKey) { var ib = new InBinding(); ib.FieldKey = fieldKey; ib.Generator = (ctx) => { return(ctx.In(outKey)); }; return(ib); }
public static InBinding FromConstantValue(string fieldKey, object value) { var ib = new InBinding(); ib.FieldKey = fieldKey; ib.Generator = (ctx) => { return(value); }; return(ib); }
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); }
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); }
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); }
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); }