重命名属性时出现奇怪的 MethodNotFound 异常 - 与 asp.net / web forms / Fluentnhibernate 和 Visual Studio 相关
我有一个本地网站,通过 Visual Studio 2008 的内部开发 Web 服务器运行(通过运行/编译按钮)。
我有一个外部库,该库在该网站的页面上引用,并位于网站的“bin”文件夹内。
我最近更改了该库中的类属性名称(将其从“ValidFrom”重命名为“VisibleFrom”),重新编译了其 dll 并覆盖了 bin 文件夹中的原始 dll。
这个类是用 FluentNHibernate 映射的,我还更改了映射并重新编译/重新部署了库。
当我尝试运行该站点并导航到使用该库的页面时,我收到与 FluentNHibernate 的配置调用相关的方法 get_ValidFrom 的 MethodNotFound 异常。 现在应该是get_VisibleFrom!
现在我已经重新配置了 NHibernate SessionProvider,以便它在每次调用时为 NHibernate 生成一个新的配置,并且不会像以前那样从 Http Session 实体中检索它,因为我认为这可能是问题所在。
但是我仍然遇到异常。 然后我删除了临时 ASP.NET 文件夹的内容...但我仍然收到错误。
使用 FluentNHibernate 时,生成的 NHibernate 模式存储在哪里?
任何人都知道这可以以某种方式缓存在哪里?
谢谢
I have a local website which I run through Visual Studio 2008's internal development web server (through the run / compile button).
I have an external library which is referenced on a page of that website and resides inside the web site's "bin" folder.
I've recently changed a class' property name inside that library (renaming it, from "ValidFrom" to "VisibleFrom"), recompiled its dll and have overwritten the original dll inside the bin folder.
This class is mapped with FluentNHibernate, I've also changed the mappings and recompiled / redeployed the library.
When I try to run the site and navigate to the page where the library is used, I'm getting a MethodNotFound exception for the method get_ValidFrom, related to FluentNHibernate's configuration call. This should be get_VisibleFrom now!
Now I've reconfigured my NHibernate SessionProvider so that it generates a new Configuration for NHibernate on each call, and does not retrieve it from the Http Session entity like it did before, because I figured there might lie the problem.
I'm still getting the exception however. I've then deleted the Temporary ASP.NET folder's content... but I'm still getting the error.
Where is the generated schema for NHibernate stored, when using FluentNHibernate?
Anyone knows where else this could somehow be cached?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FNH 不会缓存架构,它是在您调用 Fluently.Configure() 时即时生成的,并且架构会直接传递到 NHibernate 配置中用于构建
ISessionFactory
的对象。尝试清除所有已编译的对象/库/可执行文件,从使用它的所有项目中删除对库的引用,将其添加回来,然后重新编译所有内容。 另请检查您的所有代码中是否有“魔术字符串”,这些字符串可能正在引用此属性或导致它被旧名称引用。
如果这不起作用,查看堆栈跟踪可能会有所帮助,以了解从哪里调用了什么。
FNH does not cache the schema, it is generated on-the-fly when you make a call to
Fluently.Configure()
and the schema is passed directly into an NHibernateConfiguration
object which is used to build anISessionFactory
.Try clearing out all compiled objects/libraries/executables, removing the reference to your library from all projects that use it, add it back in, and then re-compile everything. Also check your all your code for "magic strings" that may be referencing this property or causing it to be referenced by the old name.
If that doesn't work, it might be helpful to see a stack trace to get an idea of what is being called from where.