Written by Minh Tuan Do
Posted at 01 Jan 2019, 09:51 PM
String query converter version 3.0 has been released!
String query converter is a powerful tool created by me, in order to help you in working with Entity Framework/Dapper.
Turning SQL query into programming languages, such as C#, is a boring job. After you finish a query, you have to convert them into C# code to run. The common approach is to concatenate these query and we might get something like this:
string query = " SELECT cntry.CountryName, " + " city.CityName, " + " cus.CustomerName " + "FROM dbo.Countries cntry " + "JOIN dbo.Cities city " + "ON cntry.CountryId = city.CountryId " + "JOIN dbo.Customers cus " + "ON cus.CityId = city.CityId " + "WHERE cus.CustomerName LIKE '%' + @cusNameKeyword + '%' " + "OR city.CityName LIKE '%' + @cityKeyword + '%' " + "OFFSET @skip ROWS" "FETCH NEXT @take ROWS ONLY"
But it's often not an interesting stuff, because you have to do it manually and the steps follow are:
1. Create a query string
2. Declare parameter variables
3. Execute and get the result using EF or Dapper
And when the query has any problem, you often do the following to debug:
1. Manually convert that query back to SQL standard
2. Execute and debug with SQL Server Management Studio
3. Edit your query to correct them
4. Repeat the 3 steps above to convert them into C# code
That's why Im here to help 🤣
String query converter version 3.0 change logs
Version 3.0 supports the following features:
- Convert SQL query into C# code
- Convert C# code into SQL Query, now support converting when using string interpolation syntax ("$") ⭐NEW!
- Automatically generate SQL Parameter and apply C# syntax, now support both Entity Framework and Dapper ⭐NEW!
- New region for daily quote and update notification ⭐NEW!
Try it now
You can download the application at the link below:
Just extract and run the .exe file.