title: Calling Oracle stored procedure using Entity Framework with output parameter?
body: <p>I have a simple Oracle stored procedure that gets three parameters passed in, and has one output parameter:</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE RA.RA_REGISTERASSET
  (
      INPROJECTNAME IN VARCHAR2
      ,INCOUNTRYCODE IN VARCHAR2
      ,INLOCATION IN VARCHAR2
      ,OUTASSETREGISTERED OUT VARCHAR2
  )
  AS
  BEGIN
    SELECT 
        INPROJECTNAME || ', ' || INLOCATION || ', ' || INCOUNTRYCODE
    INTO
        OUTASSETREGISTERED
    FROM
        DUAL;     
  END RA_REGISTERASSET;
  </code></pre>
  
  <p>I am trying to use Entity Framework 6.1 to get back the <code>OutAssetRegistered</code> value, however, I get a null after calling <code>SqlQuery</code> with no exception:</p>
  
  <pre><code>public class CmdRegisterAssetDto
  {
          public string inProjectName { get; set; }
          public string inCountryCode { get; set; }
          public string inLocation { get; set; }
          public string OutAssetRegistered { get; set; }
  }
  </code></pre>
  
  <p>//------------------------------------------------------------</p>
  
  <pre><code>string projectName = "EXCO";
  string location = "ANYWHERE";
  string countryCode = "XX";
  
  using (var ctx = new RAContext())
  {
      var projectNameParam = new OracleParameter("inProjectName", OracleDbType.Varchar2, projectName, ParameterDirection.Input);
      var countryCodeParam = new OracleParameter("inCountryCode", OracleDbType.Varchar2, countryCode, ParameterDirection.Input);
      var locationParam = new OracleParameter("inLocation", OracleDbType.Varchar2, location, ParameterDirection.Input);
      var assetRegisteredParam = new OracleParameter("OutAssetRegistered", OracleDbType.Varchar2, ParameterDirection.Output);
  
      var sql = "BEGIN RA.RA_RegisterAsset(:inProjectName, :inCountryCode, :inLocation, :OutAssetRegistered); END;";
      var query = ctx.Database.SqlQuery&lt;CmdRegisterAssetDto&gt;(sql, projectNameParam, countryCodeParam, locationParam, assetRegisteredParam
      );
  
      assetRegistered = (string)assetRegisteredParam.Value;
  }
  </code></pre>
  
  <p>I have been battling to get this to work to no avail, have checked different blogs, all the other crud operations work, can anyone please assist and direct me where I am going wrong?</p>