title: EF Core FromSQL query does not get executed immediately (PostgreSQL)
body: <p>I have written a function in PostgreSQL for insertion as follows:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION public.insert_blog("Url" character)
    RETURNS void AS
  $BODY$Begin
      Insert Into "Blogs"("Url") Values("Url");
  End$BODY$
    LANGUAGE plpgsql VOLATILE
    COST 100;
  ALTER FUNCTION public.insert_blog(character)
    OWNER TO postgres;
  </code></pre>
  
  <p>The above function adds an entry into the <code>Blogs</code> table (Url is a parameter).</p>
  
  <p>I am trying to use this function in .Net Core (<code>Npgsql.EntityFrameworkCore.PostgreSQL</code>) as follows:</p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public IActionResult Create(Blog blog)
      {
          if (ModelState.IsValid)
          {
              //This works fine
              var count = _context.Blogs.FromSql("Select insert_blog({0})", blog.Url).Count(); 
  
              //This doesn't work -- it gives an error of "42601: syntax error at or near "insert_blog""
              //var count = _context.Blogs.FromSql("insert_blog @Url={0}", blog.Url).Count();                
  
              return RedirectToAction("Index");
          }
  
          return View(blog);
      } 
  </code></pre>
  
  <p>Can someone tell me why the second command is not working? Also, even if the first command is working, is it the right way?</p>
  
  <p>Since I have to write <code>.FromSql(...).Count()</code> in order for it to work, if I remove <code>.Count()</code> item doesn't get inserted. Can someone tell me why this is happening? </p>
  
  <p>Is there any good article on using <code>.FromSql()</code> or "Using Postgres functions in entity framework core" (I'd guess that this is a new feature and that that's why I couldn't find much data on this)?</p>