querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

Is it possible to use expression for queries?

Open wireless90 opened this issue 7 years ago • 2 comments

If I have an employee class, is it possible to do this. emp => emp.ID == "1"

IDbConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ToString());

        var db = new QueryFactory(sqlConnection, new SqlServerCompiler());
        
        var query = db.Query<Employee>().From("Employees")
            .Where(emp => emp.ID == "1").Get();

        return query;`

wireless90 avatar Mar 17 '19 11:03 wireless90

No it's not within the scope, maybe it can be later, check https://github.com/sqlkata/querybuilder/pull/183 for an example provided by @senkadir

ahmad-moussawi avatar Mar 17 '19 12:03 ahmad-moussawi

Hi Ahmad , I wish I have time to complete this feature. But i will try at first chance.

senabd avatar Mar 17 '19 13:03 senabd