title: Incompatible Data Reader Exception From EF Mapped Objects
body: <p>I am using Entity Framework and have updated a table and its stored procedure but I'm getting the following error when the stored procedure is called.</p>
  
  <blockquote>
    <p>The data reader is incompatible with the specified
    'FormValueModel.Valuation'. A member of the type, 'ValuationId', does
    not have a corresponding column in the data reader with the same name.</p>
  </blockquote>
  
  <p>ValuationId is my primary key witch i want to auto increment.</p>
  
  <p>I can execute the stored procedure find from SQL management studio, And when i run my application it writes into the database but then the error message appears.</p>
  
  <p>I'm unfamiliar with Entity Framework and just have the basics, and i think it may be a mapping issue from the model.edmx.</p>
  
  <p>What would be the correct procedure in recreating and mapping the tables and stored procedures in the model?</p>
  
  <hr>
  
  <p>Stored procedure.</p>
  
  <pre><code>    ALTER PROCEDURE [dbo].[ValuationCreate]
      @TrackingNumber varchar(100),
      @FormMobiValuationId varchar(100),
      @ValuationPropertyId int,
      @ValuationFileName varchar(50)
  
  AS   
  
  SET NOCOUNT ON
  SET XACT_ABORT ON
  
  
  DECLARE @ErrorMessage varchar(1000)
  
  
  
  BEGIN TRANSACTION
  
  
      --Insert to Valuation
      INSERT INTO [Valuation]
      (
          TrackingNumber,
          FormMobiValuationId,
          ValuationPropertyId, -- new
          ValuationFileName,
          Date,
          ValuationStatus,
          IsActive
      )
      VALUES
      (
          @TrackingNumber,
          @FormMobiValuationId,
          @ValuationPropertyId,--new
          @ValuationFileName,
          GETDATE(),
          1, --Created
          1
      )
  
  
  
  
  
  IF @@ERROR &gt; 0
  BEGIN
      SET @ErrorMessage = 'Valuation Insert failed'
      GOTO ErrorHandler
  END
  ELSE
  BEGIN
      COMMIT TRANSACTION
      RETURN
  END
  
  
  
  ErrorHandler:
  
  RAISERROR(@ErrorMessage,16,1);
  ROLLBACK TRANSACTION
  RETURN -1
  </code></pre>
  
  <hr>
  
  <p>C# call where error occurs, The error message appears on the last line.</p>
  
  <pre><code> public ObjectResult&lt;Valuation&gt; ValuationCreate(global::System.String trackingNumber, global::System.String formMobiValuationId, Nullable&lt;global::System.Int32&gt; valuationPropertyId, global::System.String valuationFileName)
          {
              ObjectParameter trackingNumberParameter;
              if (trackingNumber != null)
              {
                  trackingNumberParameter = new ObjectParameter("TrackingNumber", trackingNumber);
              }
              else
              {
                  trackingNumberParameter = new ObjectParameter("TrackingNumber", typeof(global::System.String));
              }
  
              ObjectParameter formMobiValuationIdParameter;
              if (formMobiValuationId != null)
              {
                  formMobiValuationIdParameter = new ObjectParameter("FormMobiValuationId", formMobiValuationId);
              }
              else
              {
                  formMobiValuationIdParameter = new ObjectParameter("FormMobiValuationId", typeof(global::System.String));
              }
  
              ObjectParameter valuationPropertyIdParameter;
              if (valuationPropertyId.HasValue)
              {
                  valuationPropertyIdParameter = new ObjectParameter("ValuationPropertyId", valuationPropertyId);
              }
              else
              {
                  valuationPropertyIdParameter = new ObjectParameter("ValuationPropertyId", typeof(global::System.Int32));
              }
  
              ObjectParameter valuationFileNameParameter;
              if (valuationFileName != null)
              {
                  valuationFileNameParameter = new ObjectParameter("ValuationFileName", valuationFileName);
              }
              else
              {
                  valuationFileNameParameter = new ObjectParameter("ValuationFileName", typeof(global::System.String));
              }
  
              return base.ExecuteFunction&lt;Valuation&gt;("ValuationCreate", trackingNumberParameter, formMobiValuationIdParameter, valuationPropertyIdParameter, valuationFileNameParameter);
          }
  </code></pre>