Latest on twitter:

Invalid index N for this SqlParameterCollection with Count=N.

Well I have run into this a few times in the past, however as always I forget what the error meant. I googled as usual and found a guy called Derik Whittaker describing exactly the same issue, however his fix was to do with the foreign key as well as the mapped object. Now my mappings didn’t have the duplicate foreign keys so I went off for a while trying to work out what the problem is. Then on closer inspection realised that two mapped items were using the same property, which in my case was UserID.

Removed the duplicate mapping and hey presto everthing is working again.

  1. johnharman posted this