开发者

how to execute Sql Raw Query in Microsoft Entity Model Framework

开发者 https://www.devze.com 2022-12-28 13:36 出处:网络
I\'m using Microsoft Entity model framewor开发者_运维技巧k to access my database. I get an issue while i use this execute query command for executing Sql raw query. Let me know how could i resolve it.

I'm using Microsoft Entity model framewor开发者_运维技巧k to access my database. I get an issue while i use this execute query command for executing Sql raw query. Let me know how could i resolve it.

svdc.CreateQuery<VideoMasterTable>(
    "select * from videomastertable WHERE FREETEXT(*, '"+keyword+"')"
    ).ToList();

Thanks in Advance,

Kanal


CreateQuery takes ESQL, not T-SQL. In EF 4 (only), you can use ExecuteStoreQuery instead.


With CreateQuery method you are creating ObjectQuery wich will be translated to entity sql (ESQL). Entity SQL is not T-SQL. It has different syntax and uses entity operations. Entity Framework doesn't have methods for Full Text Search currently. You can create such methods or use stored procedures and call them using Entity Framework. To create your methods try this article. For using stored procedures with EF check this article.

0

精彩评论

暂无评论...
验证码 换一张
取 消