title: Get id from stored procedure insert with Dapper in .NET Core
body: <p>I'm using Dapper and I have written a stored procedure that inserts a row and returns the identity value.</p>
  <p>With Dapper, I want to capture this identity value, but the result is returned as a dynamic type and I do not know how access this id.</p>
  <p>My stored procedure:</p>
  <pre><code>CREATE PROCEDURE USER_INSERT
      (@name  varchar(30),
       @job   varchar(30))    
  AS    
  BEGIN    
      INSERT INTO User (name, job) 
      VALUES (@name, @job)
  
      SELECT SCOPE_IDENTITY()
  END 
  </code></pre>
  <p>C# code:</p>
  <pre><code>public async Task&lt;int&gt; InsertTest()
  {
      using (var connection = new SqlConnection(&quot;myconnectionstring&quot;))
      {
          string SP_INSERT = &quot;USER_INSERT&quot;;
  
          var parameters = new { name = &quot;Jon&quot;, job = &quot;developer&quot; };
  
          var insert =  await connection.QueryAsync(SP_INSERT, parameters, commandType: CommandType.StoredProcedure);
  
          var resultInsert = insert.SingleOrDefault();
      }
  
      return 0; //only for test
  }
  </code></pre>
  <p>Screenshot of the result of the query, how to access to my <code>id</code> field?</p>
  <p><a href="https://i.stack.imgur.com/pXllJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pXllJ.png" alt="enter image description here" /></a></p>