“Invalid Index n for this SqlParameterCollection with Count=n” OR “foreign key cannot be null”

て烟熏妆下的殇ゞ 提交于 2019-11-30 16:57:56

Aaargh! I was put so much on a wrong leg with this infamous “Invalid Index n for this SqlParameterCollection with Count=n” error that I overlooked the obvious: A duplicate mapping of a field for ONE of the classes. In that particular mapping I left this error, where the primary key is also defined as a property:

 <id name="ID" column="ID">
   <generator class="guid" />
 </id>
 <property name="ID" column="ID" /> 

Now that was a waste of time trying to debug that!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!