Hello guys,
Another beginner question regarding the usage of the IEventStoreConnection. According to the docs,
“The EventStoreConnection class is responsible for maintaining a full-duplex connection between the client and the event store server. EventStoreConnection is thread-safe, and it is recommended that only one instance per application is created.”
https://github.com/eventstore/eventstore/wiki/Overview-%28.NET-API%29
So, in my integration testes, I’ve thought about creating a static instance which should be used by all test methods. These test methods will usually start by opening the connection (Connect method) and by closing it up when they finish (Close method).
The first test runs just fine. However, all the others crash with the “cannot access a disposed object” when I try to open the connection.
To solve this, I had to call EventStoreConnection.Create in all the test methods. Now, should I be doing this? I mean, did I misread the docs? After all, don’t they say that I shoudl only create one instance of the IEventStoreConnection?
thanks for your patience.