Skip to content

需求:WithSql希望能参数化,谢谢! #413

Closed
@ycqhg

Description

@ycqhg

在很多场景下需要针对传入的条件进行参数化查询,需要根据条件空与否来进行拼装Parameter,比如:
var where = "";
if(name != "" && age > 0)
{
where ="where Name=@name and Age=@Age";
}
var sql = $“select * from tb {where}”;
希望能重载WithSql增加一个参数:
ISelect ISelect.WithSql(string sql, [object parms = null]);
示例:
WithSql("select * from tb where Name=@name and Age=@Age", new {Name="aaa", Age=22});
并且parms参数还可以传Dictionary<string, object>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions