EF6 Code First - Stored Proc - Search RRS feed

  • Question

  • We have a EF 6 code first solution and we now need to create an advanced feature. Obviously a stored proc and full-text search is ideal. However, I have read we should not be creating database objects with a code-first approach. Surely then our only other option is to create this search feature using our c# entities. And if we do that we cannot take advantage of SQL Servers full-text search functionality.

    Is my understanding correct?

    What is the best way to go about this considering we have a code-first solution in production?

    Friday, June 10, 2016 8:57 AM


  • Hi DarrenOD,

    >>What is the best way to go about this considering we have a code-first solution in production?

    According to your description, it seems that we could use the Database.SqlQuery method of the Entity Framework DbContext to execute the stored procedure and to pass the result back into C# code. The following blog provide a solution about stored proc and full-text search with entity framework. please refer it:


    Note: This response contains a reference to a third party World Wide Web site.Microsoft is providing this information as a convenience to you. 

    Microsoft does not control these sites and has not tested any software or information found on these sites;Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information
    found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    best regards,

    Cole Wu

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 13, 2016 1:41 AM