<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Software Artist &#187; NHibernate</title>
	<atom:link href="http://paulwideman.com/softwareartist/tag/nhibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulwideman.com/softwareartist</link>
	<description>Code is a form of art.</description>
	<lastBuildDate>Tue, 27 Sep 2011 01:22:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Using NHibernate.Linq in medium trust</title>
		<link>http://paulwideman.com/softwareartist/2009/12/30/using-nhibernate-linq-in-medium-trust/</link>
		<comments>http://paulwideman.com/softwareartist/2009/12/30/using-nhibernate-linq-in-medium-trust/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 06:31:09 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[medium trust]]></category>
		<category><![CDATA[NHibernate.Linq]]></category>

		<guid isPermaLink="false">http://paulwideman.com/softwareartist/?p=214</guid>
		<description><![CDATA[Here are some instructions for using the NHibernate.Linq functionality in the latest NHibernate trunk (3.0 alpha version) in medium trust. Disclaimer: To use NHibernate.Linq in medium trust, we have to recompile the three re-motion assemblies that NHibernate references, adding the AllowPartiallyTrustedCallersAttribute to these assemblies so they can be used in a partial trust environment. As [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some instructions for using the NHibernate.Linq functionality in the latest NHibernate trunk (3.0 alpha version) in medium trust.</p>
<p><strong>Disclaimer:</strong> To use NHibernate.Linq in medium trust, we have to recompile the three <a href="http://www.re-motion.org/">re-motion</a> assemblies that NHibernate references, adding the AllowPartiallyTrustedCallersAttribute to these assemblies so they can be used in a partial trust environment. As always, simply adding the APTCA attribute to the assembly does not guarantee that the code therein is safe for use in partial trust. Analysis of the re-motion assemblies with <a href="http://msdn.microsoft.com/en-us/library/ms165077.aspx">permcalc</a> shows that there is quite a bit of code in these assemblies that demands permissions greater than what is allowed in the standard medium trust environment. I asked the re-motion developers what they thought about setting APTCA on their assemblies, you can read their favorable response <a href="http://groups.google.com/group/re-motion-users/browse_thread/thread/9c50181663ceaf6d">here</a>. Anyway, all of this is to say that using NHibernate.Linq with these recompiled re-motion assemblies could still possibly result in exceptions in partial trust, so be sure to test your code thoroughly if you try this. I updated the SharpArch Northwind sample app to use NHibernate.Linq and I did not have any problems.</p>
<ol>
<li>First, get the re-motion source from: <a href="https://svn.re-motion.org/svn/Remotion/trunk">https://svn.re-motion.org/svn/Remotion/trunk</a></li>
<li>Read through the &#8220;How to build.txt&#8221; file, particularly the note about generating the key pair file. You might want to build the entire project from the command line just to make sure everything is set up correctly.</li>
<li>Open Remotion.sln in Visual Studio. Add the following code:
<pre class="brush: csharp; light: true; title: ;">
  using System.Security;
  [assembly: AllowPartiallyTrustedCallers]
  </pre>
<p>  to these files:</p>
<ul>
<li>Core\Core.Core\Properties\AssemblyInfo.cs</li>
<li>Core\Core.Interfaces\Properties\AssemblyInfo.cs</li>
<li>Data\Data.Linq\Properties\AssemblyInfo.cs</li>
</ul>
</li>
<li>Build the Data.Linq project, which should force a build of Core.Core and Core.Interfaces as well.</li>
<li>Copy Remotion.dll, Remotion.Interfaces.dll, and Remotion.Data.Linq.dll from trunk\Remotion\Data\Linq\bin\&lt;config&gt; to your NHibernate lib\net\3.5 directory, and rebuild NHibernate.</li>
<li>The three re-motion assemblies and the new NHibernate.dll should be usable in medium trust now.</li>
</ol>
<p>Happy partially trusted Linqing.</p>
]]></content:encoded>
			<wfw:commentRss>http://paulwideman.com/softwareartist/2009/12/30/using-nhibernate-linq-in-medium-trust/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

