Closed Iulian94 closed 5 years ago
This is not production-ready. It maybe works as a quick fix, but not ready for a release in any shape or form. Also adding extra layers of internal misdirection is just not going to fly.
Best way to go is to have a NSaga.MySql project with repository implementation. Does not matter if it repeats most of SqlServer repository. Code reuse is not always bad and when building a library is sometimes a must-have. You don't have to use PetaPoco, just do hand-crafted Sql with parameters. You don't need ORM for 2 tables.
In fact, (in some time in the future) I'm planning to upgrade this project to work with netstandard2. And at that point I'll separate SqlServer implementation into a separate project because it needs a dependency in the new world. And there there will be no ORM. Not for 2 tables and a handful of operations.
The other remaining option would be to duplicate the code and create it with a MySqlRepository, like you said. The problem with that would be that the code would get duplicated or the user of the package would have to download PetaPoco himself, and implement all the methods manually.