title: Why is NPoco ignoring column and property names and mapping almost randomly?
body: <p>I'm using the NPoco ORM (a branch of PetaPoco) but I've just noticed it's mapping the columns incorrectly in some cases. </p>
  
  <p>I'm using a stored procedure and my POCO property names are identical to the column names produced by the stored procedure:</p>
  
  <pre><code>string sql = "EXEC API_GetVenueSummaryByID @@venueID = @venueID";
  var venue = db.FirstOrDefault&lt;VenueSummary&gt;(sql, new { venueID = venueID });
  </code></pre>
  
  <p>The stored procedure is a simple SELECT statement with a couple of variables included (removing them doesn't help):</p>
  
  <pre><code>DECLARE @hasOffers bit
  IF EXISTS(SELECT * FROM Offers WHERE dbo.Offers.EntryType='V' AND Offers.EntryID =   @VenueID AND GETDATE() &lt;= validToDate) SET @hasOffers = 1
  
  SELECT  
      Venue.VenueID, VenueName, Town, County, Country, PackageCode,       
      MeetingRoomsNo, MaxMeetingCapacity, BedroomsNo,
      MetaDescription AS ShortDescription,
      'dummyresult.jpg' AS PrimaryImageFilename,
      @hasOffers AS HasSpecialOffers,
      CAST(TimeStamp AS BIGINT) AS RecordVersion
  FROM dbo.Venue
  WHERE Venue.VenueID = @VenueID
  </code></pre>
  
  <p>Is there a function in NPoco which causes it to guess the mappings (ignoring their names)? If so, how I can I disable this and force it to only match based on the column and property names?</p>
  
  <p><strike>Currently the only work around seems to be to use the column attribute</strike> <strong><em>&lt;-- doesn't work either</em></strong></p>
  
  <p>At the moment, even someone auto-formatting stored procedure (or any change which results in a change of column order) is breaking the application.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>I've noticed that if I restart the website application (eg by editing web.config or updating application code) then the column order fixes itself. So I can only assume the problem is related to NPoco internally caching the column indexes - and if the indexes change, the mappings will then be incorrect. I'm not sure if there's a mechanism to clear the cache that's perhaps not working?</p>