- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我们最近将我们的 Windows 窗体 C# 项目从 NHibernate 2.0 升级到了 2.1。我们更新了我们的 app.config 以包含“proxyfactory.factory_class”以指向所选代理(在我们的例子中为“NHibernate.ByteCode.CaSTLe”)。升级后,程序按预期构建和运行,没有任何问题。我们的问题是当试图打开任何在 Visual Studio 2008 设计器中加载时引用 NHibernate 的表单时,现在给我们以下错误(好像我们没有配置代理):
The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
堆栈跟踪:
at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory()
at NHibernate.Cfg.Configuration.Validate()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at DAL.NHibernateHelper..cctor() in ...\DAL\NHibernateHelper.cs:line 62
来自 NHibernateHelper 的第 62 行:
static NHibernateHelper()
{
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly("DAL");
sessionFactory = cfg.BuildSessionFactory(); // <-- line 62
}
这是 NHibernate 的 app.config 配置:
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.connection_string">Server=ourserver;initial catalog=ourdb;Integrated Security=SSPI</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
</configuration>
有人知道如何解决这个问题吗?谢谢!
最佳答案
我刚刚解决了同样的错误。
我的数据访问程序集有一个对 Nhibernate.ByteCode.CaSTLe.Dll 的正确引用,它出现在它的 bin/release 文件夹中。数据访问程序集中一切正常。
当我尝试使用测试程序集中的数据访问代码时抛出错误。事实证明,即使我的测试程序集引用了数据访问项目,它也没有获得 Nhibernate.ByteCode.CaSTLe.dll 的副本。在测试程序集中添加对 Nhibernate.ByteCode.CaSTLe.dll 的引用解决了这个问题。
关于c# - ProxyFactoryFactory 未配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1209106/
我们最近将我们的 Windows 窗体 C# 项目从 NHibernate 2.0 升级到了 2.1。我们更新了我们的 app.config 以包含“proxyfactory.factory_clas
考虑到此示例作为基本示例,我创建了该应用程序,但当我执行此应用程序时,出现以下错误。 The ProxyFactoryFactory was not configured. Initialize 'p
我想要一个简单的单元测试配置。我的理解是 sqlite fluent 配置默认为 CaSTLe,并且我有一个对 NHibernate.ByteCode.CaSTLe.dll 的引用设置,但是我收到一个
嗯, 当我阅读并尝试每一个类似的主题但都没有成功时,我决定发布我自己的问题。我的解决方案有一个控制台应用程序和一个用于数据访问的类库。 Nhibernate 配置位于控制台应用程序的 appconfi
我为一个新项目安装了 NuGet 包 NHibernate 和 CaSTLe.Core 3.0。通常我们手动复制dll;这是我第一次用 NuGet 做到这一点。 现在我找不到如何配置 ProxyFac
我正在尝试通过“Your first NHibernate based application”来了解其他类型的 ORM(我习惯于 DevExpress 的 XPO),我知道 tut 使用的版本之间存
我是 NHibernate 和 Fluent NHibernate 的新手,我已经使用 Fluent 1.2 for NH 3.0 大约 6 个月了。我刚刚为 NH 3.1 升级到 Fluent 1.
我是一名优秀的程序员,十分优秀!