title: How to get results from a Postgresql function using EF Core?
body: <p>My issue is <em>very very very</em> simple but I cannot accomplish this with EF Core using ASP.NET Core MVC. I am just trying to query using raw sql with EF core and return a set of rows.</p>
  <p>I have a function created in my Postgresql called show() (for testing purposes)</p>
  <p><a href="https://i.stack.imgur.com/JQkSi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JQkSi.png" alt="enter image description here" /></a></p>
  <p>I created the function with this code:</p>
  <pre><code>CREATE OR REPLACE FUNCTION public.show()
      RETURNS SETOF city
      LANGUAGE 'plpgsql'
      VOLATILE
      PARALLEL UNSAFE
      COST 100    ROWS 1000 
      
  AS $BODY$
  BEGIN
         RETURN QUERY SELECT * FROM City;                                                     
   END;
  $BODY$;
  </code></pre>
  <p>I have this in my C# Code:</p>
  <pre><code>var listOfCities = _context.Database.FromSqlRaw(&quot;SELECT public.show()&quot;).ToList();
  </code></pre>
  <p>Gives me error in the part <code>.FromSqlRaw</code>:</p>
  <blockquote>
  <p>'DatabaseFacade' does not contain a definition for 'FromSqlRaw' and no
  accessible extension method 'FromSqlRaw' accepting a first argument of
  type 'DatabaseFacade' could be found (are you missing a using
  directive or an assembly reference?)</p>
  </blockquote>
  <p>-I do not want to use any DbContext since it is a custom query that can return any object from a function.</p>
  <ul>
  <li>I know this can be accomplished just by using LINQ <code>_context.Cities.ToList()</code> but I am trying to test and learn how to use functions using raw sql WITH parameters and no parameters.</li>
  </ul>
  <p>How do I solve this? can this be accomplished with EF core?</p>