Make ESDB container implement IDatabaseContainer#1053
Make ESDB container implement IDatabaseContainer#1053alexeyzimarev wants to merge 1 commit intotestcontainers:developfrom
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
The interface represents a database container instance that can be accessed with an ADO.NET provider. Does ESDB support ADO.NET? We test against the db client.
|
I already figured it out by looking at failing test, and I am not exactly following that decision. The interface doesn't suggest anything like that, so it's unclear from the API surface what is the intention behind that interface. From the test perspective, and looking at other container implementations, it looks like MonoDB for example, is not a database when we all know it definitely is a database. Or Neo4j, or ESDB in that regard. I personally find it confusing. |
Indeed, the interface itself does not, but the description does. IIRC, the initial idea was
No one is saying that MongoDB or ESDB are not databases, but abstraction becomes significant when commonality exists. You cannot easily swap MongoDB with ESDB as you can with ADO.NET compatible containers (AFAIK). But it is definitely ambiguous. Such as the publicly available methods to retrieve the connection string, endpoint, base address, etc. Typically, I aim to correspond to the client library.
Could you provide more details about what you are trying to abstract? I would like to get a better understanding of the use cases. |
|
I have a base class that is used across different implementation, which are database-specific. In my case, the abstraction is on a high enough level to just need the I ended up making the base class generic, where the generic parameter is constrained to |
|
Maybe we can add support together with this issue. Right now, I am considering a connection string provider or something similar, which is capable of resolving the correct connection strings. This would allow developers to override the default connection string and could be used for the abstraction too. |
|
As mentioned, the interface is exclusively for ADO.NET compatible containers. I've generated a follow-up issue that includes a proposal for implementing a connection string provider across all modules. I'll close this PR. Let's carry on the discussion in the referenced issue. Thank you for bringing this to my attention. |
What does this PR do?
EvebtStoreDbContainerclass implements theGetConnectionStringmethod so it can inherit fromIDatabaseContainer.Why is it important?
When creating an abstraction for tests, I can't currently use
IDatabaseContainerand itsGetConnectionStringbecauseEventStoreDbContainerdoesn't implement the interface.