bitfoundation / bitplatform

Build all of your apps using what you already know and love ❤️
https://bitplatform.dev
MIT License
1.07k stars 222 forks source link

Provide prepared where statement in sql query parts #147

Closed rezarouzbahani closed 5 years ago

rezarouzbahani commented 5 years ago

Is your feature request related to a problem? Please describe. I need a property in SqlQueryParts which returns prepared where. For example instead of

where Id = @Param1

returns

where Id = 1

Describe the solution you'd like I've following code which works like a charm!

sqlQuery.WhereClause = Regex.Replace(sqlQuery.WhereClause, "@Param[0-9]", e =>
{
     string paramName = e.Value.Replace("@", "");
     object value = sqlQuery.Parameters[paramName];
     if (value is string strValue)
          return $"'{value}'";
     return value.ToString();
});

Describe alternatives you've considered N/A

Additional context N/A

ysmoradi commented 5 years ago

It's too risky if you use it without caution!

lock[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Read more about our automatic conversation locking policy.