public void Do() { //var connectionInfo = new ConConnectionInfo("host", "user", "password"); // ConConnection.Connect(connectionInfo) // .bind() // CommandContext<string>.New("Hello") // .Bind((s) => CommandContext<string>.New(s + " World!")) // .Bind((s) => CommandContext<string>.New(s + " Is New")) // .Print(); //UniSession us = UniObjects.OpenSession(lHostName, lUser, lPassword, lAccount, lServiceType); UniCommand cmd = new UniCommand(); //us.CreateUniCommand(); var ctx = new ExecContext(cmd); //Can we pass in a parser to handle the response?? var newCtx = ctx.Exec($"Command1") .Exec("Query executed. 0 records found.", ParseHasZeroRecords) .Exec($"Error Command2") //This should not get executed .Exec($"Command1"); var cmds = newCtx.CommandsExecuted .Reverse() .AsEnumerable() .Map((Either <ResponseException, Response> e) => match(e, Left: re => re.ToString(), Right: r => r.ToString()) ); cmds.ToList().ForEach(i => Console.WriteLine(i)); }
private ExecContext(UniCommand command, Stck <Either <ResponseException, Response> > commands) { this.cmd = command; this.CommandsExecuted = commands; }
public ExecContext(UniCommand command) { cmd = command; CommandsExecuted = new Stck <Either <ResponseException, Response> >(); }