Skip to content

Conversation

snowfrogdev
Copy link

  • Introduced a new method in Respawner to create an instance using a custom IDbAdapter.
  • Added a CustomSqliteAdapter implementation with tests to demonstrate functionality.
  • Updated README.md to include instructions for using custom database adapters.

- Introduced a new method in Respawner to create an instance using a custom IDbAdapter.
- Added a CustomSqliteAdapter implementation with tests to demonstrate functionality.
- Updated README.md to include instructions for using custom database adapters.
@0xced
Copy link
Contributor

0xced commented May 20, 2025

Introduced a new method in Respawner to create an instance using a custom IDbAdapter.

The RespawnerOptions already have an optional IDbAdapter? DbAdapter property. It's used as the adapter when not null.

The new CreateAsync overload introduced in this pull request that takes an IDbAdapter just adds confusion in my opinion.

The README already mentions how it can be used.

var respawner = await Respawner.CreateAsync(connection, new RespawnerOptions
{
    SchemasToInclude = new []
    {
        "public"
    },
    DbAdapter = DbAdapter.Postgres // 👈 optional, inferred from the connection for SQL Server, PostgreSQL, MySQL, Oracle and Informix
});

@snowfrogdev
Copy link
Author

The RespawnerOptions already have an optional IDbAdapter? DbAdapter property. It's used as the adapter when not null.

The new CreateAsync overload introduced in this pull request that takes an IDbAdapter just adds confusion in my opinion.

Wow, how did I miss that? All I remember is that I was trying to implement a SQLite Adapter and was running into issues trying to use with Respawn and it had to do with the DbAdapter not being picked up properly. I must have messed something up.

So, given that, I totally agree with you, we should just keep the existing implementation. But...

The README already mentions how it can be used.

var respawner = await Respawner.CreateAsync(connection, new RespawnerOptions
{
    SchemasToInclude = new []
    {
        "public"
    },
    DbAdapter = DbAdapter.Postgres // 👈 optional, inferred from the connection for SQL Server, PostgreSQL, MySQL, Oracle and Informix
});

To be fair, the docs could be a bit clearer on how to use a custom IDbAdapter. The docs just show that you can explicitly say which one of the built-in DbAdapters you want to use.

I've updated the PR to document how to use IDbAdapter a little better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants