gpt4 book ai didi

c# - FluentConfigurationException 未处理

转载 作者:行者123 更新时间:2023-11-30 16:28:02 25 4
gpt4 key购买 nike

FluentConfigurationException 未处理

创建 SessionFactory 时使用了无效或不完整的配置。检查 PotentialReasons 集合和 InnerException 以获取更多详细信息。

我的 SessionFactory 方法:

_sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008 //
.ConnectionString(@"Server=.\SQLExpress;Database=testdb1;Uid=dev;Pwd=123;"))
.Mappings(m => m.FluentMappings
.AddFromAssemblyOf<User>())
.ExposeConfiguration(cfg => new SchemaExport(cfg)
.Create(true, true))
.BuildSessionFactory();

内部异常是:

Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.

Possible causes are:

  • The NHibernate.Bytecode provider assembly was not deployed.

  • The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

Solution:

Confirm that your deployment folder contains one of the following assemblies:

NHibernate.ByteCode.LinFu.dll

NHibernate.ByteCode.Castle.dll

我正在控制台应用程序中进行测试。我的控制台应用程序引用了我的数据项目,该项目包含我所有的 nhibernate 实体/映射和 session 工厂代码。

Data 项目在/bin/debug 文件夹中有以下内容:

Castle.core.dll, FluentNHibernate.dll, Iesi.COllection.dll, NHibernate.ByteCode.Castle.dll, NHibernate.dll

我从 http://fluentnhibernate.org/ 下载了我所有的 .dll今天(所以它是使用 nhibernate 3.1 的流利的 1.2)

最佳答案

我认为您必须将对 NHibernate.ByteCode.CaSTLe.dll 的引用添加到您的控制台应用程序。

关于c# - FluentConfigurationException 未处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7374842/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com