In attachement are curl responses from the 2 streams :
-
before deletion
-
when deleted
-
after added some events
Produced by this test :
[TestMethod]
public async Task TheSoftDeleteThenProjectionProblem()
{
var stream1 = “mystream1” + Guid.NewGuid().ToString().ToLower();
var stream2 = “mystream2” + Guid.NewGuid().ToString().ToLower();
using (var factory = new EventStoreEventStreamFactory())
{
var repos = factory.GetRepository();
IEventStoreConnection connection = factory._connection;
await repos.AppendEvents(stream1,
new ProductCreatedEvent { ProductId = "p1" },
new ProductCreatedEvent { ProductId = "p2" },
new ProductCreatedEvent { ProductId = "p3" },
new ProductCreatedEvent { ProductId = "p4" },
new ProductDeletedEvent { ProductId = "p4" }
);
await repos.AppendEvents(stream2,
new ProductChangedEvent { ProductId = "p1" },
new ProductDeletedEvent { ProductId = "p2" },
new ProductCreatedEvent { ProductId = "p3" }
);
WriteHttp("http://127.0.0.1:2114/streams/" + stream1);
WriteHttp("http://127.0.0.1:2114/streams/" + stream2);
await connection.DeleteStreamAsync(stream1, ExpectedVersion.Any);
await connection.DeleteStreamAsync(stream2, ExpectedVersion.Any);
WriteHttp("http://127.0.0.1:2114/streams/" + stream1);
WriteHttp("http://127.0.0.1:2114/streams/" + stream2);
await repos.AppendEvents(stream1,
new ProductCreatedEvent { ProductId = "p1" },
new ProductCreatedEvent { ProductId = "p2" },
new ProductCreatedEvent { ProductId = "p3" },
new ProductCreatedEvent { ProductId = "p4" },
new ProductDeletedEvent { ProductId = "p4" }
);
await repos.AppendEvents(stream2,
new ProductChangedEvent { ProductId = "p1" },
new ProductDeletedEvent { ProductId = "p2" },
new ProductCreatedEvent { ProductId = "p3" }
);
WriteHttp("http://127.0.0.1:2114/streams/" + stream1);
WriteHttp("http://127.0.0.1:2114/streams/" + stream2);
}
}
void WriteHttp(string address)
{
System.Console.WriteLine("\n\n--------------------------------------- :: " + address);
var startInfo = new ProcessStartInfo(“curl”, "-i " + address);
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
var curl = System.Diagnostics.Process.Start(startInfo);
curl.WaitForExit();
System.Console.Out.Write(curl.StandardOutput.ReadToEnd());
}
``
I post the answer of your second question in a few moments.
curl responses.txt (15.1 KB)