OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.42k stars 2.39k forks source link

ShellDbTablesRemovingHandler depends on the DbConnection implementation #14217

Open dministro opened 1 year ago

dministro commented 1 year ago

The ShellDbTablesRemovingHandler depends on the DbConnection implementation, this makes mocking and automated testing hard.

See:

https://github.com/OrchardCMS/OrchardCore/blob/80c747468dd48038888b2634e3f5443e2d2d80c7/src/OrchardCore/OrchardCore.Data.YesSql/Removing/ShellDbTablesRemovingHandler.cs#L79-L85

It would be great if we could avoid direct depending on implementations.

hishamco commented 1 year ago

Totally agree, do you want to submit a PR or let me know if I can fix this

jtkech commented 1 year ago

Hmm, I don't see any obvious way to remove this dependency because yes ClearPool() is specific to SqliteConnection ;)

dministro commented 1 year ago

As I see it, this can be done in YesSql via IStore since this is YesSql's scope.

I can imagine one more method for IStore:

    public interface IStore : IDisposable
    {
        Task RemoveAsync(...);
    }