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 搜索发现外国朋友也有许多遇到同样问题的。也都没有解决, 所以写下中英的希望外国的朋友能看懂我的中国英语!

 

posted @ 2009-06-29 14:47  Beggar  阅读(10991)  评论(1编辑  收藏  举报