Peta POCO like query issue

I am using Micro ORM PetaPOCO, and I want to use like query, i am getting exception, please help me if any one know.

var context = new PetaPoco.Database(Connection.connectionstring);
            SqlQuery = @"SELECT CmsPage.PageId, CmsPage.PageTitle, CmsPage.MenuId, CmsPage.PageDescription, CmsPage.Title, CmsPage.MetaKeyword, CmsPage.MetaDescription, CmsPage.CreatedDate, CmsPage.IsActive
            FROM ( SELECT ROW_NUMBER() OVER (ORDER BY CmsPage.PageTitle) AS row, CmsPage.PageId, CmsPage.PageTitle, CmsPage.MenuId, CmsPage.PageDescription,
            CmsPage.Title, CmsPage.MetaKeyword, CmsPage.MetaDescription, CmsPage.CreatedDate, CmsPage.IsActive FROM CmsPage ) AS CmsPage WHERE
            CmsPage.PageTitle LIKE @0 and row > ((@CurrPage - 1) * @PageSize)  and  row <= (@CurrPage * @PageSize)";


            List<CmsPagePOCO> obCmsPagePOco = context.Query<CmsPagePOCO>(
                SqlQuery, 
                    new 
                    {
                        @CurrPage = CurrPage,
                        @PageSize = PageSize,
                        @PageTitle = "%" + PageTitle + "%"

                    }).ToList();

            return obCmsPagePOco;

getting this exception :

No mapping exists from object type <>f__AnonymousType1`3[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] to a known managed provider native type.

Answers


You are mixing @0 in the like with named parameters

change to:

CmsPage.PageTitle LIKE @PageTitle and row > ...

Need Your Help

Hidden/exposed station in MACA protocol

computer-science network-protocols wireless

I'm trying to understand how the MACA protocol solves the hidden/exposed station problem in wireless comunication networks.

Yellow Dog Linux 6.1 and PS3 GameOS Versions?

linux cell firmware ps3

I'm working on installing linux on a PS3 to do some development work and I've run across a bit of a snag. The current version of the firmware on my PS3 is 2.50. The Yellow Dog website specifically

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.