Note that there are some explanatory texts on larger screens.

plurals
  1. POReflectionPermission problems when using Ninject 2.2, Fluent NHibernate in a Medium Trust environment
    text
    copied!<p>I am using <em>(from Nuget packages)</em> Ninject 2.2 and Fluent NHibernate 1.3 (NHibernate v3.2 under the hood) and I've hit a brick wall.</p> <p>I am using Fluent config to point to my database, mappings etc: </p> <pre><code>var fluentConfig = Fluently.Configure() (MsSqlConfiguration.MsSql2008.DoNot.UseReflectionOptimizer() .ConnectionString(c =&gt; c.FromConnectionStringWithKey("ExampleDB"))) .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;ExampleMap&gt;() .Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never())) .ExposeConfiguration(x =&gt; x .SetProperty("current_session_context_class", "web")) .ExposeConfiguration(BuildSchema); </code></pre> <p>The code works beautify on my local box, until I set <strong>&lt; trust level="Medium" /></strong> to mirror my hosting provider and then it starts to barf.</p> <p>The problem line is the 2nd one in this code block </p> <pre><code>Bind&lt;Configuration&gt;().ToConstant(fluentConfig.BuildConfiguration()); Bind&lt;ISessionFactory&gt;().ToConstant(fluentConfig.BuildSessionFactory()); Bind&lt;ISession&gt;().ToMethod(x =&gt; GetRequestSession(x)); </code></pre> <p><em>The exception I recieve: "...Request for the permission of type 'System.Security.Permissions.ReflectionPermission....failed"</em></p> <p>Does anyone have any suggestions? My investigations thus far are turning up nothing but either out of date info based on older versions of Ninject and NHibernate or solutions that involve decompiling X to disengage Y...which I'd rather not do!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload