I'm a developer and team lead trying to find the most elegant balance between user needs, business goals, and technical constraints. There are few things more satisfying than striking the right balance, creating a product that solves the job to be done effectively, built efficiently and without waste.
On my current project, we wanted to use named parameters in our queries. Unfortunately, we are using the MySQL ODBC driver for .NET, and named parameters are not supported. Positional parameters are supported, so we created a little utility to help.
The helper function is straightforward to use. Instead of using connection.CreateCommand, you pass your statement and parameters to connection.CreateCommandWithNamedParamaters, like:
CreateCommandWithNamedParameters is as simple as
This code is in the public domain. Use it however you wish.