<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: NHibernate in a Medium Trust Environment</title>
	<atom:link href="http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/feed/" rel="self" type="application/rss+xml" />
	<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>
	<lastBuildDate>Fri, 03 Sep 2010 16:52:29 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: dev</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-230</link>
		<dc:creator>dev</dc:creator>
		<pubDate>Sat, 04 Jul 2009 04:08:59 +0000</pubDate>
		<guid isPermaLink="false">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>
	<item>
		<title>By: Mario</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-223</link>
		<dc:creator>Mario</dc:creator>
		<pubDate>Sun, 22 Mar 2009 01:45:36 +0000</pubDate>
		<guid isPermaLink="false">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: Joel</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-201</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Mon, 27 Oct 2008 16:44:00 +0000</pubDate>
		<guid isPermaLink="false">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 &quot;45 day money back guarantee&quot; policy and I&#039;ll do as you suggest.
I&#039;m in the situation you were sometime ago: I want to put a project online and don&#039;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: Mike Gavaghan</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-200</link>
		<dc:creator>Mike Gavaghan</dc:creator>
		<pubDate>Mon, 27 Oct 2008 11:33:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/#comment-200</guid>
		<description>Yes, but it&#039;s an account that&#039;s over a year old.  Perhaps their new policy only applies to new accounts?  I don&#039;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&#039;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-page-1/#comment-199</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Sat, 25 Oct 2008 21:47:19 +0000</pubDate>
		<guid isPermaLink="false">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&#039;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: Manuel Abadia</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-72</link>
		<dc:creator>Manuel Abadia</dc:creator>
		<pubDate>Wed, 31 Oct 2007 20:10:10 +0000</pubDate>
		<guid isPermaLink="false">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&#039;t show up before:

add key=&quot;hibernate.bytecode.provider&quot; value=&quot;null&quot;</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: Manuel Abadia</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-71</link>
		<dc:creator>Manuel Abadia</dc:creator>
		<pubDate>Wed, 31 Oct 2007 20:08:26 +0000</pubDate>
		<guid isPermaLink="false">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&#039;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: Andrey</title>
		<link>http://www.gavaghan.org/blog/2007/08/21/nhibernate-in-a-medium-trust-environment/comment-page-1/#comment-69</link>
		<dc:creator>Andrey</dc:creator>
		<pubDate>Tue, 23 Oct 2007 07:15:56 +0000</pubDate>
		<guid isPermaLink="false">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&#039;t allow Nhibernate works properly. I will ask them to allow using reflection without restrictions for my application, maybe i won&#039;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 <img src='http://www.gavaghan.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
</channel>
</rss>
