essentialfactor / Dommel

Simple CRUD operations for Dapper.
MIT License
0 stars 0 forks source link

Refactor to use Dapper.ISqlBuilder internally #1

Open TroySchmidt opened 4 years ago

TroySchmidt commented 4 years ago

Dapper.ISqlBuilder internally provides a better mechanism of using SQL templates and the ability to add in joins for multimapping. Refactoring to use this would allow us to better develop completely dynamic GraphQL SQL queries.

The important piece is just like .Where() and .Select() we need a similar mechanism to add the join and the custom fields that are to be selected.

Inspiration can be drawn from Dapper.GraphQL implementation of using SqlBuilder for multimapping.

TroySchmidt commented 4 years ago

@tswacast I started a branch for this and created a new class SqlQuery. The intent is that this class will be used for building queries using both the Dommel.Resolvers and Dapper.SqlBuilder. Once the class is implemented, we can then add the join query to the IForeignKeyResolver interface and class. Currently there is convention based relationships and instead of letting those be determined in DommelMapper.Multimap, they will be in the foreign key resolver. This will allow us to later add methods to Dapper.Fluentmap.Dommel to allow for custom join queries.