Introduction
Dapper.SimpleSqlBuilder enhances the Dapper experience by simplifying the construction of both static and dynamic SQL queries. Leveraging string interpolation and a fluent API, it enables developers to easily create safe, parameterized SQL queries. This efficiency is achieved by utilizing FormattableString and interpolated string handlers, ensuring that parameters are securely captured.
Note
The library provides a feature set for building and parametrizing SQL queries, however all of Dapper's features and quirks still apply for query parameters.
Key Features
- Provides a simple and natural way to write SQL queries using string interpolation.
- Chainable methods and fluent APIs for building SQL queries.
- Supports parameter reuse within queries.
- Dependency injection support.
- Conditional methods for building dynamic SQL queries.
- Performant and memory efficient. Performs similarly or better when compared to Dapper's SqlBuilder.
The library provides two builders for building SQL queries:
- Builder - for building static, dynamic and complex SQL queries.
- Fluent Builder - for building dynamic SQL queries using a fluent API.
Packages
The library provides multiple packages to suit your needs.
Dapper.SimpleSqlBuilder: A simple and performant SQL builder for Dapper, using string interpolation and a fluent API to build safe, static, and dynamic SQL queries.
Dapper.SimpleSqlBuilder.StrongName: A package that uses Dapper.StrongName.
Dapper.SimpleSqlBuilder.DependencyInjection: Dependency injection extension for Dapper.SimpleSqlBuilder.
Database Support
The library supports any database that Dapper supports. However, the library has been tested against the latest versions of MSSQL, MySQL and PostgreSQL databases.
Share Your Feedback
If you like the library, use it, share it, and give it a ⭐️ on GitHub. For any suggestions, feature requests, or issues feel free to create an issue on GitHub to help improve the library.