nhibernate proxy generator

青春壹個敷衍的年華 提交于 2020-01-07 01:21:35

问题


I am attempting to get nhibernate working in medium-trust. What I found said that I needed to use a proxy generator. I pulled the one from nhibernate's site. When I attempt to use it, I recieve an error that it could not load the assembly 'DynamicProxyGenAssembly2'. Is there something I am missing or is there one that works somewhere. I would prefer not to use the generator, but there seems to be no alternative with nhibernate.


回答1:


From what I gather the issue with medium trust is the use of reflection being nerfed some what (though I could be completely off here).

It also seems that your approach of physically pre-building the proxy objects seems to be the suggested one and this link may help.

To be honest I had a similar issue with shared hosting and decided to opt for using a a hosting provider that offered virtual server. This obviously removes the medium trust issue as it's like having a cheap and nasty dedicated server at your disposal.

I know that this answer may not have been the best, but I do feel your pain and wanted to chime up a little. Also, its worth mentioning that the best place to get NHibernate related questions answered is their forums (http://forum.hibernate.org).




回答2:


Thad I know this question is old, but I just wanted to tell you and others with this issue that it is really pretty easy to run NHibernate in a medium trust environment once you know what to do. All you have to do is to do the following:

  1. Rebuild Castle from source and get the dlls from that
  2. Rebuild NHibernate from source using the dlls from the prior step and get the dlls
  3. Add the dlls to your project.

You need to pay attention to the versions of Castle and NHibernate to make sure that they will work together, but you don't have to disable lazy loading or do anything else. Here is a blog post about it that outlines how you can easily set up your project in a medium trust environment: How To Run NHibernate In A Medium Trust Environment



来源:https://stackoverflow.com/questions/608492/nhibernate-proxy-generator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!