0
我正在使用Micro ORM PetaPOCO,我想用查詢,我收到異常,請幫助我,如果任何人知道。Peta POCO like query issue
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;
得到此異常:
沒有映射從對象類型存在<> f__AnonymousType1`3 [[System.Int32,mscorlib程序,版本= 4.0.0.0,文化=中性公鑰= 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]]轉換爲已知的託管提供程序本機類型。
是的,我已經做了已經,您也對好接受這個答案:)我有另外一個問題,如果你有任何想法請訪問:http://stackoverflow.com/questions/18412562/web-api-400-badrequest-when-search-parameter-is-blank/18412781?noredirect=1#comment27048785_18412781 – dotnetexpert