<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: NHibernate in a Medium Trust Environment</title>
	<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/</link>
	<description>Mike Gavaghan blogs on Java, C#, .Net, and the software industry</description>
	<pubDate>Thu, 11 Mar 2010 21:45:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>

	<item>
		<title>By: sarmaad</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-62</link>
		<author>sarmaad</author>
		<pubDate>Tue, 02 Oct 2007 10:44:40 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-62</guid>
					<description>great post, but do you know if the new version of nhibernate have addressed this isse. i am struggling with this issue myself!!</description>
		<content:encoded><![CDATA[<p>great post, but do you know if the new version of nhibernate have addressed this isse. i am struggling with this issue myself!!</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Mike Gavaghan</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-63</link>
		<author>Mike Gavaghan</author>
		<pubDate>Tue, 02 Oct 2007 11:40:13 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-63</guid>
					<description>I'm not sure what they plan to do.  Reflection and dynamic invocation are fundamental to the NHibernate design, so I don't think anything can be done to change the code.

On the other hand, I don't think this is a bug in NHibernate. I think the hosting providers are being unreasonable in their security settings.  I think the "fix" is to pressure the hosting providers into permitting the use of this basic and conventional programming mechanism.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure what they plan to do.  Reflection and dynamic invocation are fundamental to the NHibernate design, so I don&#8217;t think anything can be done to change the code.</p>
<p>On the other hand, I don&#8217;t think this is a bug in NHibernate. I think the hosting providers are being unreasonable in their security settings.  I think the &#8220;fix&#8221; is to pressure the hosting providers into permitting the use of this basic and conventional programming mechanism.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Andrey</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-69</link>
		<author>Andrey</author>
		<pubDate>Tue, 23 Oct 2007 07:15:56 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-69</guid>
					<description>Thanks for post, i bought shared hosting at 1and1.com, they too have same restrictions which doesn't allow Nhibernate works properly. I will ask them to allow using reflection without restrictions for my application, maybe i won't replace them on Webhost4life :).</description>
		<content:encoded><![CDATA[<p>Thanks for post, i bought shared hosting at 1and1.com, they too have same restrictions which doesn&#8217;t allow Nhibernate works properly. I will ask them to allow using reflection without restrictions for my application, maybe i won&#8217;t replace them on Webhost4life :).</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Manuel Abadia</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-71</link>
		<author>Manuel Abadia</author>
		<pubDate>Wed, 31 Oct 2007 20:08:26 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-71</guid>
					<description>Mike,

you can disable the reflection optimizer setting putting this in the NHibernate config section:



That should work in medium trust if you don't access private members through reflection (forget using the accessor nosetter.camelcase-underscore).</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>you can disable the reflection optimizer setting putting this in the NHibernate config section:</p>
<p>That should work in medium trust if you don&#8217;t access private members through reflection (forget using the accessor nosetter.camelcase-underscore).</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Manuel Abadia</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-72</link>
		<author>Manuel Abadia</author>
		<pubDate>Wed, 31 Oct 2007 20:10:10 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-72</guid>
					<description>I guess the less than and greater than characters are not friendly. This is what didn't show up before:

add key="hibernate.bytecode.provider" value="null"</description>
		<content:encoded><![CDATA[<p>I guess the less than and greater than characters are not friendly. This is what didn&#8217;t show up before:</p>
<p>add key=&#8221;hibernate.bytecode.provider&#8221; value=&#8221;null&#8221;</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Joel</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-199</link>
		<author>Joel</author>
		<pubDate>Sat, 25 Oct 2008 21:47:19 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-199</guid>
					<description>are you still using NHibernate on a shared hosting environment at webhost4life? I quit my account at godaddy because nhibernate did not work and contacted webhost4life to make sure they support it before I sing up for the account. Their answer was that they do not support it on any shared hosting server. Now I'm a bit confused 

Are still using nhibernate on a shared hosting environment at webhost4life?

Thanks</description>
		<content:encoded><![CDATA[<p>are you still using NHibernate on a shared hosting environment at webhost4life? I quit my account at godaddy because nhibernate did not work and contacted webhost4life to make sure they support it before I sing up for the account. Their answer was that they do not support it on any shared hosting server. Now I&#8217;m a bit confused </p>
<p>Are still using nhibernate on a shared hosting environment at webhost4life?</p>
<p>Thanks</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Mike Gavaghan</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-200</link>
		<author>Mike Gavaghan</author>
		<pubDate>Mon, 27 Oct 2008 11:33:19 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-200</guid>
					<description>Yes, but it's an account that's over a year old.  Perhaps their new policy only applies to new accounts?  I don't know.

You might ask if they offer a trial period.  You could try out your apps, but then take a refund if it doesn't work out.</description>
		<content:encoded><![CDATA[<p>Yes, but it&#8217;s an account that&#8217;s over a year old.  Perhaps their new policy only applies to new accounts?  I don&#8217;t know.</p>
<p>You might ask if they offer a trial period.  You could try out your apps, but then take a refund if it doesn&#8217;t work out.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Joel</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-201</link>
		<author>Joel</author>
		<pubDate>Mon, 27 Oct 2008 16:44:00 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-201</guid>
					<description>hi Mike,

thanks a lot for your reply. They do have a "45 day money back guarantee" policy and I'll do as you suggest.
I'm in the situation you were sometime ago: I want to put a project online and don't want to invest too much in hosting. Using NHibernate would also mean less work. 

Thank you once again,
Joel</description>
		<content:encoded><![CDATA[<p>hi Mike,</p>
<p>thanks a lot for your reply. They do have a &#8220;45 day money back guarantee&#8221; policy and I&#8217;ll do as you suggest.<br />
I&#8217;m in the situation you were sometime ago: I want to put a project online and don&#8217;t want to invest too much in hosting. Using NHibernate would also mean less work. </p>
<p>Thank you once again,<br />
Joel</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Mario</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-223</link>
		<author>Mario</author>
		<pubDate>Sun, 22 Mar 2009 01:45:36 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-223</guid>
					<description>Hi,

I also had the problem making NHibernate work with medium trust and this is what I did:

First..you need some sort of hosting that allows reflection in your server...There are some like crystaltech.com which will allow you to use reflection (in shared hosting) as long as it is used for assemblies within your designated app folder.

Second...

Download the Castle.DynamicProxy-vs2005 project. NHibernate ships with the dll, but you will need to modify the assembly to allow lazy loading under medium trust. Once you have the assembly, make sure nhibernate references this assembly and not the old dll.

Open the Castle.DynamicProxy-vs2005 project and look for the ModuleScope.cs file (it is right in the main directory). There look for the method:
private AssemblyName GetAssemblyName (bool signStrongName)
In there comment out the following code:

if (signStrongName)
         {
             byte[] keyPairStream = GetKeyPair();

             if (keyPairStream != null)
             {
                 assemblyName.KeyPair = new StrongNameKeyPair(keyPairStream);
             }
         }




Now give it a shot.

Mario</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I also had the problem making NHibernate work with medium trust and this is what I did:</p>
<p>First..you need some sort of hosting that allows reflection in your server&#8230;There are some like crystaltech.com which will allow you to use reflection (in shared hosting) as long as it is used for assemblies within your designated app folder.</p>
<p>Second&#8230;</p>
<p>Download the Castle.DynamicProxy-vs2005 project. NHibernate ships with the dll, but you will need to modify the assembly to allow lazy loading under medium trust. Once you have the assembly, make sure nhibernate references this assembly and not the old dll.</p>
<p>Open the Castle.DynamicProxy-vs2005 project and look for the ModuleScope.cs file (it is right in the main directory). There look for the method:<br />
private AssemblyName GetAssemblyName (bool signStrongName)<br />
In there comment out the following code:</p>
<p>if (signStrongName)<br />
         {<br />
             byte[] keyPairStream = GetKeyPair();</p>
<p>             if (keyPairStream != null)<br />
             {<br />
                 assemblyName.KeyPair = new StrongNameKeyPair(keyPairStream);<br />
             }<br />
         }</p>
<p>Now give it a shot.</p>
<p>Mario</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: dev</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-230</link>
		<author>dev</author>
		<pubDate>Sat, 04 Jul 2009 04:08:59 +0000</pubDate>
		<guid>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-230</guid>
					<description>To use NH in Medium Trust use Proxy Generators (of NHContrib)
http://nhforge.org/wikis/proxygenerators10/introduction.aspx</description>
		<content:encoded><![CDATA[<p>To use NH in Medium Trust use Proxy Generators (of NHContrib)<br />
<a href="http://nhforge.org/wikis/proxygenerators10/introduction.aspx" rel="nofollow">http://nhforge.org/wikis/proxygenerators10/introduction.aspx</a></p>
]]></content:encoded>
				</item>
</channel>
</rss>
