Migrating from old servicestack - IDbConnection.Query<T>()

46 views
Skip to first unread message

Lucas Nodine

unread,
Mar 9, 2014, 8:37:49 PM3/9/14
to servic...@googlegroups.com
Assuming mythz will probable be the source on this, so thank you in advance.

I make frequent use of IdBConnection.Query<T>(string SQL, object anon) in much of my existing code.  I'm trying to move forward to 4.0.12 and running into problems as it appears .Query is no longer supported.

Can you let me know what method I should be using for something like the following:


        public override List<DBOs.Matters.Matter> GetList(Rest.Requests.Matters.Matter request, IDbConnection db)
        {
            string filterClause = "";

            if (!string.IsNullOrEmpty(request.Title))
                filterClause += " LOWER(\"title\") like '%' || LOWER(@Title) || '%' AND";
            
            //return db.Query<DBOs.Matters.Matter>(
            //    "SELECT * FROM \"matter\" WHERE" + filterClause,
            //    new { Title = request.Title });

            db.SqlList<DBOs.Matters.Matter>(

            return db.Query<DBOs.Matters.Matter>("SELECT * FROM \"matter\" JOIN \"secured_resource_acl\" ON " +
                "\"matter\".\"id\"=\"secured_resource_acl\".\"secured_resource_id\" " +
                "WHERE " + filterClause +
                "\"secured_resource_acl\".\"allow_flags\" & 2 > 0 " +
                "AND NOT \"secured_resource_acl\".\"deny_flags\" & 2 > 0 " +
                "AND \"matter\".\"utc_disabled\" is null  " +
                "AND \"secured_resource_acl\".\"utc_disabled\" is null",
                new { Title = request.Title });
        }

Lucas Nodine

unread,
Mar 9, 2014, 8:40:40 PM3/9/14
to servic...@googlegroups.com
Please ignore the db.SqlList line, that is just me attempting to figure this out in code.
Reply all
Reply to author
Forward
0 new messages