title: How to add SQL user-defined function to entity framework?
body: <p>Can I add a SQL function to my .edmx file like I do in .dbml? If I can, how to do that? If I can not, is there any workaround?</p>
  
  <p>I tried to Google but can't find any concrete answer about how to do that.</p>
  
  <p>Based on the given answer I have created a Stored procedure and tried to add a 'import function', but it says <strong>'the stored procedure returns no column'</strong> . Where am I doing wrong?
  The function:</p>
  
  <pre><code>ALTER FUNCTION [dbo].[fn_locationSearch](@keyword varchar(10))
  RETURNS TABLE
  AS
  RETURN
  (
  SELECT CustomerBranch.ID,CustomerBranch.BranchName,CustomerBranch.Longitude,CustomerBranch.Latitue,CustomerBranch.Telephone,CustomerBranch.CategoryID,CustomerBranch.Description
  
  FROM FREETEXTTABLE (CustomerOffer,*,@keyword) abc INNER JOIN OffersInBranch
  ON abc.[key]=OffersInBranch.OfferID INNER JOIN CustomerBranch ON     OffersInBranch.BranchID=CustomerBranch.ID
  UNION
  SELECT    CustomerBranch.ID,CustomerBranch.BranchName,CustomerBranch.Longitude,CustomerBranch.Latitude,CustomerBranch.Telephone,CustomerBranch.CategoryID,CustomerBranch.Description
  FROM CustomerBranch WHERE FREETEXT(*,@keyword)
  )
  </code></pre>
  
  <p>The Stored procedure:</p>
  
  <pre><code>ALTER PROCEDURE USP_locationSearch
  (@keyword varchar(10))
  AS
  BEGIN
  SELECT * from dbo.fn_locationSearch(@keyword)
  END
  </code></pre>