Linq的NHibernate 3.1迁移问题 [英] NHibernate 3.1 migration problem with Linq

查看:74
本文介绍了Linq的NHibernate 3.1迁移问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临着从NHibernate 2.1.2 + Fluent 1.0迁移到NHibernate 3.1 + Fluent 1.2的问题:

I am facing a issue regarding the migration from NHibernate 2.1.2 + Fluent 1.0 to NHibernate 3.1 + Fluent 1.2 :

曾经工作:

 List<Order> orders = session.Linq<Order>()
                .Where(o => o.OrderLines.Any(ol => printStatuses.Contains(ol.PrintStatus)))
                .ToList();

不再工作

 List<Order> orders = session.Query<Order>()
                .Where(o => o.OrderLines.Any(ol => printStatuses.Contains(ol.PrintStatus)))
                .ToList();

我们收到以下错误:

无法加载类型 o.OrderLines .可能的原因:未加载或未指定程序集."

"Could not load type o.OrderLines. Possible cause: the assembly was not loaded or not specified."

OrderLines 是类 Order 的集合属性,类型为 IList< OrderLine>

OrderLines is a collection property of the class Order, typed IList<OrderLine>

NHibernate似乎无法获取该集合的完全限定的类名.不过,从会话工厂的角度来看,我们可以看到 collectionRolesByEntityParticipant 字典包含类 OrderLine 的键,其字典值指向 Order.Orderlines >.

NHibernate seems to not be able to get the fully qualified class name of that collection. Though, looking at the session factory, we can see that collectionRolesByEntityParticipant dictionary contains a key for the class OrderLine with a dictionary value pointing to Order.Orderlines.

有人解决了吗?

PS:如果您有疑问,我们会使用自动映射.

PS : We use automapping in case you wonder.

推荐答案

就像提到的@cremor一样,这可能与nhibernate或您的应用程序无关.我遇到了同样的问题.如果转到异常"对话框(Ctrl+Alt+E),则可能已为所有公共语言运行时异常"选中了抛出".选中它们后,即使抛出try异常,Visual Studio也会在每次引发异常时闯入调试器.通常,当您对某个程序集具有依赖性时,您将不拥有/控制该程序集,则仅引用该dll,而没有pdb调试文件的副本.除非它具有pdb文件,否则Visual Studio不知道会闯入调试器.

Like @cremor mentioned, this likely isn't a problem with nhibernate or your app. I ran into the same issue. If you go to the Exceptions Dialog box (Ctrl+Alt+E) you probably have "throw" checked for all "Common Language Runtime Exceptions". When they are checked, visual studio will break into the debugger everytime an exception is thrown, even if it is handled by a try catch. Normally when you have a dependency on an assembly you don't own/control, you only reference the dll and you don't have a copy of the pdb debugging files. Visual Studio doesn't know to break into the debugger unless it has the pdb files.

TL; DR-删除NHibernate.pdb,Iesi.Collections.pdb,Nhibernate.ByteCode.Castle.pdb文件和Visual Studio不会打入调试器,并且会不断困扰.

这篇关于Linq的NHibernate 3.1迁移问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆