Nhibernate 拋出異常 System.Collections.Generic.KeyNotFoundException 給定關鍵字不在字典中

這個問題困擾今天一上午。

 

 每次F5 都會停在
press F5 stop this

 private static readonly ISessionFactory sessionFactory = configuration.BuildSessionFactory();

 然後拋出
then throw exception

 System.Collections.Generic.KeyNotFoundException 給定關鍵字不在字典中

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

 

這個異常。
this exception

 

最後發現 在做model類的時候好幾個 Employee 被我打成了Employye 導致了這個異常。 上午搜了 解決的方法不多。特在此留下記號

如果你也遇到同樣的錯誤。請仔細檢查你的實體類。

 

Solution: Check entity class and hbm.xml files

 

英語爛的不行,上google 搜索發現外國朋友也有許多遇到同樣問題的。也都沒有解決, 所以寫下中英的希望外國的朋友能看懂我的中國英語!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章